VPC Firewall Operations
CreateVpcFirewall
API Request
POST zstack/v1/vpcfirewallsAuthorization: OAuth the-session-uuid{
"params": {
"vpcUuid": "bc370cafacc83fad8f3ad583dea8da12",
"description": "example-des",
"name": "example-name"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vpcUuid":"bc370cafacc83fad8f3ad583dea8da12","description":"example-des","name":"example-name"}}' http://localhost:8080/zstack/v1/vpcfirewalls| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vpcUuid | String | body (contained in the params structure) | 3.6.0 | ||
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.6.0 | |
| name | String | body (contained in the params structure) | The resource name. | 3.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "name",
"refs": [
{
"id": 1.0,
"ruleSetUuid": "06fc56b0483a3bf487b9cdfeaa6c4be2",
"l3NetworkUuid": "27e1a95342083ce4a790d4f9dcf7f9bd",
"packetsForwardType": "in",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"description": "example-des"
}
}| 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.6.0 |
| inventory | VpcFirewallInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| refs | List | See refs. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| ruleSetUuid | String | 3.6.0 | |
| l3Uuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| packetsForwardType | PacketsForwardType | See packetsForwardType. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| in | PacketsForwardType | 3.6.0 | |
| out | PacketsForwardType | 3.6.0 | |
| local | PacketsForwardType | 3.6.0 |
SDK Sample
CreateVpcFirewallAction action = new CreateVpcFirewallAction();
action.vpcUuid = "bc370cafacc83fad8f3ad583dea8da12";
action.description = "example-des";
action.name = "example-name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVpcFirewallAction.Result res = action.call();CreateVpcFirewallAction action = CreateVpcFirewallAction()
action.vpcUuid = "bc370cafacc83fad8f3ad583dea8da12"
action.description = "example-des"
action.name = "example-name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVpcFirewallAction.Result res = action.call()QueryVpcFirewall
API Request
GET zstack/v1/vpcfirewalls
GET zstack/v1/vpcfirewalls/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewallscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/98631b6cb2b33384b780e1ef61aff0d0Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVpcFirewall, and pressing the Tab key.
API Response
{
"inventories": [
{
"name": "name",
"refs": [
{
"id": 1.0,
"ruleSetUuid": "01a959eec095396eaed841c886219eec",
"l3NetworkUuid": "76cbd34de351334bbd0f51ee0653d0ab",
"packetsForwardType": "in",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"description": "example-des"
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| refs | List | See refs. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| ruleSetUuid | String | 3.6.0 | |
| l3NetworkUuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| packetsForwardType | PacketsForwardType | See packetsForwardType. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| in | PacketsForwardType | 3.6.0 | |
| out | PacketsForwardType | 3.6.0 | |
| local | PacketsForwardType | 3.6.0 |
SDK Sample
QueryVpcFirewallAction action = new QueryVpcFirewallAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVpcFirewallAction.Result res = action.call();QueryVpcFirewallAction action = QueryVpcFirewallAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVpcFirewallAction.Result res = action.call()UpdateVpcFirewall
API Request
PUT zstack/v1/vpcfirewalls/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateVpcFirewall": {
"description": "example-des",
"name": "example-name"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVpcFirewall":{"description":"example-des","name":"example-name"}}' http://localhost:8080/zstack/v1/vpcfirewalls/822689d1957d30378fe0c200df72f33a/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| description | String | body (contained in the updateVpcFirewall structure) | Optional. The detailed description of the resource. | 3.6.0 | |
| name | String | body (contained in the updateVpcFirewall structure) | Optional. The resource name. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "example-name",
"refs": [
{
"id": 1.0,
"ruleSetUuid": "b3074e9040ef3a2ea30d5843a85b3cdb",
"l3NetworkUuid": "a53439b32bc133b2a95bd09c9a8c5b67",
"packetsForwardType": "in",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"description": "example-des"
}
}| 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.6.0 |
| inventory | VpcFirewallInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| refs | List | See refs. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| ruleSetUuid | String | 3.6.0 | |
| l3Uuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| packetsForwardType | PacketsForwardType | See packetsForwardType. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| in | PacketsForwardType | 3.6.0 | |
| out | PacketsForwardType | 3.6.0 | |
| local | PacketsForwardType | 3.6.0 |
SDK Sample
UpdateVpcFirewallAction action = new UpdateVpcFirewallAction();
action.uuid = "822689d1957d30378fe0c200df72f33a";
action.description = "example-des";
action.name = "example-name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVpcFirewallAction.Result res = action.call();UpdateVpcFirewallAction action = UpdateVpcFirewallAction()
action.uuid = "822689d1957d30378fe0c200df72f33a"
action.description = "example-des"
action.name = "example-name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVpcFirewallAction.Result res = action.call()RefreshFirewall
API Request
PUT zstack/v1/vpcfirewalls/refresh/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"refreshFirewall": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"refreshFirewall":{}}' http://localhost:8080/zstack/v1/vpcfirewalls/refresh/f461b936af043aa89aa2bdeb221085e7/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "name",
"refs": [
{
"id": 1.0,
"ruleSetUuid": "05cc1e225ef83107b6075d758c8dcee2",
"l3NetworkUuid": "178e23cc9fdc3673b90ee258fe60395f",
"packetsForwardType": "in",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"description": "example-des"
}
}| 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.6.0 |
| inventory | VpcFirewallInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| refs | List | See refs. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| ruleSetUuid | String | 3.6.0 | |
| l3Uuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| packetsForwardType | PacketsForwardType | See packetsForwardType. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| in | PacketsForwardType | 3.6.0 | |
| out | PacketsForwardType | 3.6.0 | |
| local | PacketsForwardType | 3.6.0 |
SDK Sample
RefreshFirewallAction action = new RefreshFirewallAction();
action.uuid = "f461b936af043aa89aa2bdeb221085e7";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshFirewallAction.Result res = action.call();RefreshFirewallAction action = RefreshFirewallAction()
action.uuid = "f461b936af043aa89aa2bdeb221085e7"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshFirewallAction.Result res = action.call()DeleteFirewall
API Request
DELETE zstack/v1/vpcfirewalls/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vpcfirewalls/09b37275fd073e4db292628ea260dd20?deleteMode=Permissive
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. |
|
4.0.0 |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteFirewallAction action = new DeleteFirewallAction();
action.uuid = "09b37275fd073e4db292628ea260dd20";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFirewallAction.Result res = action.call();DeleteFirewallAction action = DeleteFirewallAction()
action.uuid = "09b37275fd073e4db292628ea260dd20"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteFirewallAction.Result res = action.call()CreateFirewallRuleSet
API Request
POST zstack/v1/vpcfirewalls/ruleSetsAuthorization: OAuth the-session-uuid{
"params": {
"name": "name",
"actionType": "drop",
"description": "example-des"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"name","vpcFirewallUuid":"e9a77f42bdbb3b5692012c6007a5893a","actionType":"drop","description":"example-des"}}' http://localhost:8080/zstack/v1/vpcfirewalls/ruleSets| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The ruleset name. | 3.6.0 | |
| actionType | String | body (contained in the params structure) | Optional. The action taken against data packets. |
|
3.6.0 |
| description | String | body (contained in the params structure) | Optional. The detailed description of the ruleset. | 3.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The ruleset UUID. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "name",
"actionType": "drop",
"description": "example-des",
"enableDefaultLog": false,
"isDefault": false,
"isApplied": true
}
}| 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.6.0 |
| inventory | VpcFirewallRuleSetInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| isDefault | boolean | 3.6.0 | |
| isApplied | boolean | Indicates whether the ruleset is applied. | 4.0.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| actionType | ActionType | See actionType. | 3.6.0 |
| rules | List | See rules. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The firewall rule UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of the rule. | 3.6.0 |
| allowStates | String | The allow status of data packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isApplied | boolean | Indicates whether the rule is applied. | 4.0.0 |
| expired | boolean | Indicates whether the rule is expired. | 4.0.0 |
| isDefault | boolean | Indicates whether the rule is a system rule. | 3.6.0 |
| description | String | The detailed description of the rule. | 3.6.0 |
| createDate | Timestamp | The time when the rule was created. | 3.6.0 |
| lastOpDate | Timestamp | The time when the rule was last modified. | 3.6.0 |
| action | ActionType | See action. | 3.6.0 |
| protocol | ProtocolType | See protocol. | 3.6.0 |
| state | FirewallRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
CreateFirewallRuleSetAction action = new CreateFirewallRuleSetAction();
action.name = "name";
action.vpcFirewallUuid = "e9a77f42bdbb3b5692012c6007a5893a";
action.actionType = "drop";
action.description = "example-des";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFirewallRuleSetAction.Result res = action.call();CreateFirewallRuleSetAction action = CreateFirewallRuleSetAction()
action.name = "name"
action.vpcFirewallUuid = "e9a77f42bdbb3b5692012c6007a5893a"
action.actionType = "drop"
action.description = "example-des"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateFirewallRuleSetAction.Result res = action.call()QueryFirewallRuleSet
API Response
GET zstack/v1/vpcfirewalls/ruleSets
GET zstack/v1/vpcfirewalls/ruleSets/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/ruleSetscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/ruleSets/a26016d5c50a3908a0692d57d033c154Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryFirewallRuleSet, and pressing the Tab key.
API Response
{
"inventories": [
{
"name": "name",
"actionType": "drop",
"description": "example-des",
"enableDefaultLog": false,
"isDefault": false,
"isApplied": false
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| isDefault | boolean | 3.6.0 | |
| isApplied | boolean | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| actionType | ActionType | See actionType. | 3.6.0 |
| rules | List | See rules. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The firewall rule UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of the rule. | 3.6.0 |
| allowStates | String | The allow status of data packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isApplied | boolean | Indicates whether the rule is applied. | 4.0.0 |
| expired | boolean | Indicates whether the rule is expired. | 4.0.0 |
| isDefault | boolean | Indicates whether the rule is a system rule. | 3.6.0 |
| description | String | The detailed description of the rule. | 3.6.0 |
| createDate | Timestamp | The time when the rule was created. | 3.6.0 |
| lastOpDate | Timestamp | The time when the rule was last modified. | 3.6.0 |
| action | ActionType | See action. | 3.6.0 |
| protocol | ProtocolType | See protocol. | 3.6.0 |
| state | FirewallRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
QueryFirewallRuleSetAction action = new QueryFirewallRuleSetAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFirewallRuleSetAction.Result res = action.call();QueryFirewallRuleSetAction action = QueryFirewallRuleSetAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFirewallRuleSetAction.Result res = action.call()UpdateFirewallRuleSet
API Request
PUT zstack/v1/vpcfirewalls/ruleSets/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateFirewallRuleSet": {
"description": "example-des",
"actionType": "drop"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateFirewallRuleSet":{"description":"example-des","actionType":"drop"}}' http://localhost:8080/zstack/v1/vpcfirewalls/ruleSets/6b93eca80a9032c3a567b2e3af0f03db/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| name | String | body (contained in the updateFirewallRuleSet structure) | Optional. The resource name. | 3.6.0 | |
| description | String | body (contained in the updateFirewallRuleSet structure) | Optional. The detailed description of the resource. | 3.6.0 | |
| actionType | String | body (contained in the updateFirewallRuleSet structure) | Optional. The action type. |
|
3.6.0 |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "name",
"actionType": "drop",
"description": "example-des",
"enableDefaultLog": false,
"isDefault": false,
"isApplied": true
}
}| 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.6.0 |
| inventory | VpcFirewallRuleSetInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| isDefault | boolean | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| actionType | ActionType | See actionType. | 3.6.0 |
| rules | List | See rules | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of a rule. | 3.6.0 |
| allowStates | String | The state of packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isApplied | boolean | Indicates whether the ruleset is applied. | 4.0.0 |
| expired | boolean | Indicates whether the ruleset is expired. | 4.0.0 |
| isDefault | boolean | Indicates whether the ruleset is the default ruleset. | 3.6.0 |
| description | String | The detailed description of the ruleset. | 3.6.0 |
| createDate | Timestamp | The time when the ruleset was created. | 3.6.0 |
| lastOpDate | Timestamp | The time when the ruleset was modified. | 3.6.0 |
| action | ActionType | See action | 3.6.0 |
| protocol | ProtocolType | See protocolprotocol | 3.6.0 |
| state | FirewallRuleState | See state | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
UpdateFirewallRuleSetAction action = new UpdateFirewallRuleSetAction();
action.uuid = "6b93eca80a9032c3a567b2e3af0f03db";
action.description = "example-des";
action.actionType = "drop";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateFirewallRuleSetAction.Result res = action.call();UpdateFirewallRuleSetAction action = UpdateFirewallRuleSetAction()
action.uuid = "6b93eca80a9032c3a567b2e3af0f03db"
action.description = "example-des"
action.actionType = "drop"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateFirewallRuleSetAction.Result res = action.call()DeleteFirewallRuleS
API Request
DELETE zstack/v1/vpcfirewalls/ruleSets/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vpcfirewalls/ruleSets/62b6ef32f6573f01929c5020d976bd66?deleteMode=Permissive
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. |
|
4.0.0 |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteFirewallRuleSetAction action = new DeleteFirewallRuleSetAction();
action.uuid = "62b6ef32f6573f01929c5020d976bd66";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFirewallRuleSetAction.Result res = action.call();DeleteFirewallRuleSetAction action = DeleteFirewallRuleSetAction()
action.uuid = "62b6ef32f6573f01929c5020d976bd66"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteFirewallRuleSetAction.Result res = action.call()AttachFirewallRuleSetToL3
API Request
POST zstack/v1/vpcfirewalls/ruleSets/{ruleSetUuid}/l3networks/{l3Uuid}Authorization: OAuth the-session-uuid{
"params": {
"vpcFirewallUuid": "d5a0a7ce8bdf315a87189bb3f1c12f98",
"forward": "in"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vpcFirewallUuid":"d5a0a7ce8bdf315a87189bb3f1c12f98","forward":"in"}}' http://localhost:8080/zstack/v1/vpcfirewalls/ruleSets/c9ada0bdf0ec3b0a87e534030e4d9b8c/l3networks/b552d497789f3609a764e03fbdf535ad| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vpcFirewallUuid | String | body (contained in the params structure) | 3.6.0 | ||
| l3Uuid | String | url | 3.6.0 | ||
| forward | String | body (contained in the params structure) |
|
3.6.0 | |
| ruleSetUuid | String | url | 3.6.0 | ||
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"id": 1.0,
"ruleSetUuid": "91e9fed42a113c0395a81920c4179a43",
"l3NetworkUuid": "ad2bbeb82973334fa0ab243f52088fea",
"packetsForwardType": "in",
"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.6.0 |
| inventory | VpcFirewallRuleSetL3RefInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| ruleSetUuid | String | 3.6.0 | |
| l3NetworkUuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| packetsForwardType | PacketsForwardType | See packetsForwardType. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| in | PacketsForwardType | 3.6.0 | |
| out | PacketsForwardType | 3.6.0 | |
| local | PacketsForwardType | 3.6.0 |
SDK Sample
AttachFirewallRuleSetToL3Action action = new AttachFirewallRuleSetToL3Action();
action.vpcFirewallUuid = "d5a0a7ce8bdf315a87189bb3f1c12f98";
action.l3Uuid = "b552d497789f3609a764e03fbdf535ad";
action.forward = "in";
action.ruleSetUuid = "c9ada0bdf0ec3b0a87e534030e4d9b8c";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachFirewallRuleSetToL3Action.Result res = action.call();AttachFirewallRuleSetToL3Action action = AttachFirewallRuleSetToL3Action()
action.vpcFirewallUuid = "d5a0a7ce8bdf315a87189bb3f1c12f98"
action.l3Uuid = "b552d497789f3609a764e03fbdf535ad"
action.forward = "in"
action.ruleSetUuid = "c9ada0bdf0ec3b0a87e534030e4d9b8c"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachFirewallRuleSetToL3Action.Result res = action.call()DetachFirewallRuleSetFromL3
API Request
POST zstack/v1/vpcfirewalls/l3networks/{l3Uuid}Authorization: OAuth the-session-uuid{
"params": {
"vpcFirewallUuid": "582cdc20cf313b8696da15f67f71c38f",
"forward": "in"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vpcFirewallUuid":"582cdc20cf313b8696da15f67f71c38f","forward":"in"}}' http://localhost:8080/zstack/v1/vpcfirewalls/l3networks/912cc5a14b193c2fa76290eac7046230| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vpcFirewallUuid | String | body (contained in the params structure) | The firewall UUID. | 3.6.0 | |
| l3Uuid | String | url | The L3 network UUID. | 3.6.0 | |
| forward | String | body (contained in the params structure) | The forwarding direction. |
|
3.6.0 |
| ruleSetUuid | String | url | 4.0.0 | ||
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DetachFirewallRuleSetFromL3Action action = new DetachFirewallRuleSetFromL3Action();
action.vpcFirewallUuid = "582cdc20cf313b8696da15f67f71c38f";
action.l3Uuid = "912cc5a14b193c2fa76290eac7046230";
action.forward = "in";
action.ruleSetUuid = "a54a917869733b5590053eb3f4505089";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachFirewallRuleSetFromL3Action.Result res = action.call();DetachFirewallRuleSetFromL3Action action = DetachFirewallRuleSetFromL3Action()
action.vpcFirewallUuid = "582cdc20cf313b8696da15f67f71c38f"
action.l3Uuid = "912cc5a14b193c2fa76290eac7046230"
action.forward = "in"
action.ruleSetUuid = "a54a917869733b5590053eb3f4505089"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachFirewallRuleSetFromL3Action.Result res = action.call()QueryFirewallRuleSetL3Ref
API Request
GET zstack/v1/vpcfirewalls/l3networks/rulesets/refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/l3networks/rulesets/refsQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryFirewallRuleSetL3Ref, and pressing the Tab key.
API Response
{
"inventories": [
{
"id": 1.0,
"ruleSetUuid": "f4575926f7a13c82a0d610dfac995ffa",
"l3NetworkUuid": "85044a1e0ccb3c859c0b024e967fb191",
"packetsForwardType": "in",
"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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| ruleSetUuid | String | 3.6.0 | |
| l3NetworkUuid | String | The L3 network UUID. | 3.6.0 |
| vpcFirewallUuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| packetsForwardType | PacketsForwardType | See packetsForwardType. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| in | PacketsForwardType | 3.6.0 | |
| out | PacketsForwardType | 3.6.0 | |
| local | PacketsForwardType | 3.6.0 |
SDK Sample
QueryFirewallRuleSetL3RefAction action = new QueryFirewallRuleSetL3RefAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFirewallRuleSetL3RefAction.Result res = action.call();QueryFirewallRuleSetL3RefAction action = QueryFirewallRuleSetL3RefAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFirewallRuleSetL3RefAction.Result res = action.call()CreateFirewallRule
API Request
POST /v1/vpcfirewalls/rulesAuthorization: OAuth the-session-uuid{
"params": {
"ruleSetUuid": "0079c9339a7f32d69c289119ff223d81",
"action": "accept",
"protocol": "tcp",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"description": "example rule des"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vpcFirewallUuid":"bd79e42aa97f360585e91a8defa639e2","ruleSetUuid":"0e453dd8d6543540ac4ae293806c9d04","action":"accept","protocol":"tcp","destPort":"22","sourcePort":"22","sourceIp":"192.168.1.2","destIp":"192.168.1.1","allowStates":"invalid,new","tcpFlag":"SYN","icmpTypeName":"echo-reply","ruleNumber":1001.0,"enableLog":false,"state":"disable","description":"example rule des"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| ruleSetUuid | String | body (contained in the params structure) | The ruleset UUID. | 3.6.0 | |
| action | String | body (contained in the params structure) | The action taken against data packets. |
|
3.6.0 |
| protocol | String | body (contained in the params structure) | Optional. The protocol. | 3.6.0 | |
| destPort | String | body (contained in the params structure) | Optional. The destination port. | 3.6.0 | |
| sourcePort | String | body (contained in the params structure) | Optional. The source port. | 3.6.0 | |
| sourceIp | String | body (contained in the params structure) | Optional. The source IP address. | 3.6.0 | |
| destIp | String | body (contained in the params structure) | Optional. The destination IP address. | 3.6.0 | |
| allowStates | String | body (contained in the params structure) | Optional. The allow status of packets. | 3.6.0 | |
| tcpFlag | String | body (contained in the params structure) | Optional. The TCP flag. | 3.6.0 | |
| icmpTypeName | String | body (contained in the params structure) | Optional. The ICMP type. | 3.6.0 | |
| ruleNumber | Integer | body (contained in the params structure) | The priority of the rule. | 3.6.0 | |
| enableLog | boolean | body (contained in the params structure) | Optional. Specifies whether to enable logging. | 3.6.0 | |
| state | String | body (contained in the params structure) | The action that changes the state of the rule. |
|
3.6.0 |
| description | String | body (contained in the params structure) | Optional. The detailed description of the rule. | 3.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The rule UUID. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"ruleSetUuid": "34db2df69d593f0b893a2cc9035bd2f3",
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"ruleNumber": 1001.0,
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"enableLog": false,
"isApplied": true,
"expired": false,
"state": "disable",
"isDefault": false,
"description": "example rule des"
}
}| 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.6.0 |
| inventory | VpcFirewallRuleInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The firewall rule UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of the rule. | 3.6.0 |
| allowStates | String | Indicates the allow status of packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isDefault | boolean | Indicates whether the rule is applied. | 3.6.0 |
| expired | boolean | Indicates whether the rule is expired. | 4.0.0 |
| isApplied | boolean | Indicates whether the rule is a system rule. | 4.0.0 |
| description | String | The detailed description of the rule. | 3.6.0 |
| createDate | Timestamp | The time when the rule was created. | 3.6.0 |
| lastOpDate | Timestamp | The time when the rule was last modified. | 3.6.0 |
| action | ActionType | See action. | 3.6.0 |
| protocol | ProtocolType | See protocol. | 3.6.0 |
| state | FirewallRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
CreateFirewallRuleAction action = new CreateFirewallRuleAction();
action.vpcFirewallUuid = "bd79e42aa97f360585e91a8defa639e2";
action.ruleSetUuid = "0e453dd8d6543540ac4ae293806c9d04";
action.action = "accept";
action.protocol = "tcp";
action.destPort = "22";
action.sourcePort = "22";
action.sourceIp = "192.168.1.2";
action.destIp = "192.168.1.1";
action.allowStates = "invalid,new";
action.tcpFlag = "SYN";
action.icmpTypeName = "echo-reply";
action.ruleNumber = 1001.0;
action.enableLog = false;
action.state = "disable";
action.description = "example rule des";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFirewallRuleAction.Result res = action.call();CreateFirewallRuleAction action = CreateFirewallRuleAction()
action.vpcFirewallUuid = "bd79e42aa97f360585e91a8defa639e2"
action.ruleSetUuid = "0e453dd8d6543540ac4ae293806c9d04"
action.action = "accept"
action.protocol = "tcp"
action.destPort = "22"
action.sourcePort = "22"
action.sourceIp = "192.168.1.2"
action.destIp = "192.168.1.1"
action.allowStates = "invalid,new"
action.tcpFlag = "SYN"
action.icmpTypeName = "echo-reply"
action.ruleNumber = 1001.0
action.enableLog = false
action.state = "disable"
action.description = "example rule des"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateFirewallRuleAction.Result res = action.call()CreateFirewallRuleFromConfigFile
API Request
POST zstack/v1/vpcfirewalls/rules/from-fileAuthorization: OAuth the-session-uuid{
"params": {
"ruleInfo": "[{\"ruleNumber\":1004,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ICMP\",\"tcpFlag\":null,\"icmpTypeName\":\"echo-reply\",\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.41\",\"destIp\":\"192.168.0.50\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1003,\"action\":\"reject\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"UDP\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":\"77\",\"destPort\":\"88\",\"sourceIp\":\"192.168.0.31\",\"destIp\":\"192.168.0.40\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1002,\"action\":\"drop\",\"allowStates\":\"new,invalid,related\",\"protocol\":\"TCP\",\"tcpFlag\":\"SYN,ACK\",\"icmpTypeName\":null,\"sourcePort\":\"55\",\"destPort\":\"66\",\"sourceIp\":\"192.168.0.21\",\"destIp\":\"192.168.0.30\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1001,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ALL\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.10\",\"destIp\":\"192.168.0.20\",\"description\":null,\"state\":\"enable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"}]"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"params":{"ruleInfo":"[{\"ruleNumber\":1004,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ICMP\",\"tcpFlag\":null,\"icmpTypeName\":\"echo-reply\",\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.41\",\"destIp\":\"192.168.0.50\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1003,\"action\":\"reject\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"UDP\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":\"77\",\"destPort\":\"88\",\"sourceIp\":\"192.168.0.31\",\"destIp\":\"192.168.0.40\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1002,\"action\":\"drop\",\"allowStates\":\"new,invalid,related\",\"protocol\":\"TCP\",\"tcpFlag\":\"SYN,ACK\",\"icmpTypeName\":null,\"sourcePort\":\"55\",\"destPort\":\"66\",\"sourceIp\":\"192.168.0.21\",\"destIp\":\"192.168.0.30\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1001,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ALL\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.10\",\"destIp\":\"192.168.0.20\",\"description\":null,\"state\":\"enable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"}]"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules/from-file| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| ruleInfo | String | body (contained in the params structure) | The firewall rule information. | 4.4.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 4.4.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID. | 4.4.0 | |
| systemTags | List | body | Optional. The system tags. | 4.4.0 | |
| userTags | List | body | Optional. The user tags. | 4.4.0 |
API Response
{
"inventory": [
{
"name": "name",
"actionType": "drop",
"description": "example-des",
"enableDefaultLog": false,
"isDefault": false,
"isApplied": true
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.4.0 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.4.0 |
| inventory | VpcFirewallRuleSetInventory | See inventory. | 4.4.0 |
| 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. | 4.4.0 |
| description | String | The brief description of the error. | 4.4.0 |
| details | String | The details about the error. | 4.4.0 |
| elaboration | String | The reserved field. Default value: null. | 4.4.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.4.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. | 4.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.4.0 |
| name | String | The resource name. | 4.4.0 |
| description | String | The detailed description of the resource. | 4.4.0 |
| isDefault | boolean | 4.4.0 | |
| isApplied | boolean | 4.4.0 | |
| createDate | Timestamp | The creation time. | 4.4.0 |
| lastOpDate | Timestamp | The last operation time. | 4.4.0 |
| actionType | ActionType | See actionType. | 4.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 4.4.0 | |
| reject | ActionType | 4.4.0 | |
| accept | ActionType | 4.4.0 |
SDK Sample
CreateFirewallRuleFromConfigFileAction action = new CreateFirewallRuleFromConfigFileAction();
action.ruleInfo = "[{"ruleNumber":1004,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ICMP","tcpFlag":null,"icmpTypeName":"echo-reply","sourcePort":null,"destPort":null,"sourceIp":"192.168.0.41","destIp":"192.168.0.50","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1003,"action":"reject","allowStates":"new,established,invalid,related","protocol":"UDP","tcpFlag":null,"icmpTypeName":null,"sourcePort":"77","destPort":"88","sourceIp":"192.168.0.31","destIp":"192.168.0.40","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1002,"action":"drop","allowStates":"new,invalid,related","protocol":"TCP","tcpFlag":"SYN,ACK","icmpTypeName":null,"sourcePort":"55","destPort":"66","sourceIp":"192.168.0.21","destIp":"192.168.0.30","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1001,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ALL","tcpFlag":null,"icmpTypeName":null,"sourcePort":null,"destPort":null,"sourceIp":"192.168.0.10","destIp":"192.168.0.20","description":null,"state":"enable", "ruleSetUuid": "${defaultRuleSet.uuid}"}]";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFirewallRuleFromConfigFileAction.Result res = action.call();CreateFirewallRuleFromConfigFileAction action = CreateFirewallRuleFromConfigFileAction()
action.ruleInfo = "[{"ruleNumber":1004,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ICMP","tcpFlag":null,"icmpTypeName":"echo-reply","sourcePort":null,"destPort":null,"sourceIp":"192.168.0.41","destIp":"192.168.0.50","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1003,"action":"reject","allowStates":"new,established,invalid,related","protocol":"UDP","tcpFlag":null,"icmpTypeName":null,"sourcePort":"77","destPort":"88","sourceIp":"192.168.0.31","destIp":"192.168.0.40","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1002,"action":"drop","allowStates":"new,invalid,related","protocol":"TCP","tcpFlag":"SYN,ACK","icmpTypeName":null,"sourcePort":"55","destPort":"66","sourceIp":"192.168.0.21","destIp":"192.168.0.30","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1001,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ALL","tcpFlag":null,"icmpTypeName":null,"sourcePort":null,"destPort":null,"sourceIp":"192.168.0.10","destIp":"192.168.0.20","description":null,"state":"enable", "ruleSetUuid": "${defaultRuleSet.uuid}"}]"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateFirewallRuleFromConfigFileAction.Result res = action.call()QueryFirewallRule
API Request
GET zstack/v1/vpcfirewalls/rulesGET zstack/v1/vpcfirewalls/rules/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/rulescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/rules/ace430872549342fbaca32f1d4c333e1Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryFirewallRule, and pressing the Tab key.
API Response
{
"inventories": [
{
"ruleSetUuid": "9fe12b6d1b3d38dbab13405722ccf264",
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"ruleNumber": 1001.0,
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"enableLog": false,
"isApplied": true,
"expired": false,
"state": "disable",
"isDefault": false,
"description": "example rule des"
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The firewall rule UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of the rule. | 3.6.0 |
| allowStates | String | The allow status of data packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isDefault | boolean | Indicates whether the rule is applied. | 3.6.0 |
| isApplied | boolean | Indicates whether the rule is expired. | 4.0.0 |
| expired | boolean | Indicates whether the rule is a system rule. | 4.0.0 |
| description | String | The detailed description of the rule. | 3.6.0 |
| createDate | Timestamp | The time when the rule was created. | 3.6.0 |
| lastOpDate | Timestamp | The time when the rule was last modified. | 3.6.0 |
| action | ActionType | See action. | 3.6.0 |
| protocol | ProtocolType | See protocol. | 3.6.0 |
| state | FirewallRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
QueryFirewallRuleAction action = new QueryFirewallRuleAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFirewallRuleAction.Result res = action.call();QueryFirewallRuleAction action = QueryFirewallRuleAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFirewallRuleAction.Result res = action.call()UpdateFirewallRule
API Request
PUT zstack/v1/vpcfirewalls/rules/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateFirewallRule": {
"ruleSetUuid": "c7b605d7c7e037f8b4df43bfe5a26d0f",
"action": "accept",
"protocol": "tcp",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"description": "example rule des"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateFirewallRule":{"vpcFirewallUuid":"181da73e752432b283d3096bb29afb59","ruleSetUuid":"cb6db506c523354282aecf56acd4b78d","action":"accept","protocol":"tcp","destPort":"22","sourcePort":"22","sourceIp":"192.168.1.2","destIp":"192.168.1.1","allowStates":"invalid,new","tcpFlag":"SYN","icmpTypeName":"echo-reply","ruleNumber":1001.0,"enableLog":false,"state":"disable","description":"example rule des"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules/7e9bd2ad1f48320d8782d737b262abb1/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| ruleSetUuid | String | body (contained in the updateFirewallRule structure) | The ruleset UUID. | 3.6.0 | |
| uuid | String | url | The rule UUID. | 3.6.0 | |
| action | String | body (contained in the updateFirewallRule structure) | The action taken against data packets. |
|
3.6.0 |
| protocol | String | body (contained in the updateFirewallRule structure) | Optional. The protocol. | 3.6.0 | |
| destPort | String | body (contained in the updateFirewallRule structure) | Optional. The destination port. | 3.6.0 | |
| sourcePort | String | body (contained in the updateFirewallRule structure) | Optional. The source port. | 3.6.0 | |
| sourceIp | String | body (contained in the updateFirewallRule structure) | Optional. The source IP address. | 3.6.0 | |
| destIp | String | body (contained in the updateFirewallRule structure) | Optional. The destination IP address. | 3.6.0 | |
| allowStates | String | body (contained in the updateFirewallRule structure) | Optional. The allow status of packets. | 3.6.0 | |
| tcpFlag | String | body (contained in the updateFirewallRule structure) | Optional. The TCP flag. | 3.6.0 | |
| icmpTypeName | String | body (contained in the updateFirewallRule structure) | Optional. The ICMP type. | 3.6.0 | |
| ruleNumber | Integer | body (contained in the updateFirewallRule structure) | The priority of the rule. | 3.6.0 | |
| enableLog | boolean | body (contained in the updateFirewallRule structure) | Optional. Specifies whether to enable logging. | 3.6.0 | |
| state | String | body (contained in the updateFirewallRule structure) | The action that changes the state of the rule. |
|
3.6.0 |
| description | String | body (contained in the updateFirewallRule structure) | Optional. The detailed description of the rule. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"ruleSetUuid": "52099ab881ba30a09589fa0040a1b6a2",
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"ruleNumber": 1001.0,
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"enableLog": false,
"isApplied": true,
"expired": false,
"state": "disable",
"isDefault": false,
"description": "example rule des"
}
}| 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.6.0 |
| inventory | VpcFirewallRuleInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The firewall rule UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of the rule. | 3.6.0 |
| allowStates | String | Indicates the allow status of packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isApplied | boolean | Indicates whether the rule is applied. | 4.0.0 |
| expired | boolean | Indicates whether the rule is expired. | 4.0.0 |
| isDefault | boolean | Indicates whether the rule is a default rule. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| action | ActionType | See action. | 3.6.0 |
| protocol | ProtocolType | See protocol. | 3.6.0 |
| state | FirewallRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
UpdateFirewallRuleAction action = new UpdateFirewallRuleAction();
action.ruleSetUuid = "c7b605d7c7e037f8b4df43bfe5a26d0f";
action.uuid = "7e9bd2ad1f48320d8782d737b262abb1";
action.action = "accept";
action.protocol = "tcp";
action.destPort = "22";
action.sourcePort = "22";
action.sourceIp = "192.168.1.2";
action.destIp = "192.168.1.1";
action.allowStates = "invalid,new";
action.tcpFlag = "SYN";
action.icmpTypeName = "echo-reply";
action.ruleNumber = 1001.0;
action.enableLog = false;
action.state = "disable";
action.description = "example rule des";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateFirewallRuleAction.Result res = action.call();UpdateFirewallRuleAction action = UpdateFirewallRuleAction()
action.ruleSetUuid = "c7b605d7c7e037f8b4df43bfe5a26d0f"
action.uuid = "7e9bd2ad1f48320d8782d737b262abb1"
action.action = "accept"
action.protocol = "tcp"
action.destPort = "22"
action.sourcePort = "22"
action.sourceIp = "192.168.1.2"
action.destIp = "192.168.1.1"
action.allowStates = "invalid,new"
action.tcpFlag = "SYN"
action.icmpTypeName = "echo-reply"
action.ruleNumber = 1001.0
action.enableLog = false
action.state = "disable"
action.description = "example rule des"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateFirewallRuleAction.Result res = action.call()DeleteFirewallRule
API Request
DELETE zstack/v1/vpcfirewalls/rules/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vpcfirewalls/rules/6238605440b535dd9f7d5d033a732659?deleteMode=Permissive
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. |
|
4.0.0 |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteFirewallRuleAction action = new DeleteFirewallRuleAction();
action.uuid = "6238605440b535dd9f7d5d033a732659";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFirewallRuleAction.Result res = action.call();DeleteFirewallRuleAction action = DeleteFirewallRuleAction()
action.uuid = "6238605440b535dd9f7d5d033a732659"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteFirewallRuleAction.Result res = action.call()ChangeFirewallRuleState
API Request
PUT zstack/v1/vpcfirewalls/rules/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"changeFirewallRuleState": {
"state": "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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeFirewallRuleState":{"state":"disable"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules/4eef3024e5bd36f38be22b5af9807b20/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| state | String | body (contained in the changeFirewallRuleState structure) | The action to change the state of the firewall rule. |
|
3.6.0 |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"ruleSetUuid": "387ccd99cb2b3374a24f86108c3b8653",
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"ruleNumber": 1001.0,
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"enableLog": false,
"isApplied": true,
"expired": false,
"isDefault": false,
"description": "example rule des"
}
}| 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.6.0 |
| inventory | VpcFirewallRuleInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The firewall rule UUID. | 3.6.0 |
| ruleSetUuid | String | The ruleset UUID. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| ruleNumber | Integer | The priority of the rule. | 3.6.0 |
| allowStates | String | The allow status of data packets. | 3.6.0 |
| tcpFlag | String | The TCP flag. | 3.6.0 |
| icmpTypeName | String | The ICMP type. | 3.6.0 |
| isApplied | boolean | Indicates whether the rule is applied. | 4.0.0 |
| expired | boolean | Indicates whether the rule is expired. | 4.0.0 |
| isDefault | boolean | Indicates whether the rule is a system rule. | 3.6.0 |
| description | String | The detailed description of the rule. | 3.6.0 |
| createDate | Timestamp | The time when the rule was created. | 3.6.0 |
| lastOpDate | Timestamp | The time when the rule was last modified. | 3.6.0 |
| action | ActionType | See action. | 3.6.0 |
| protocol | ProtocolType | See protocol. | 3.6.0 |
| state | FirewallRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 3.6.0 | |
| reject | ActionType | 3.6.0 | |
| accept | ActionType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 3.6.0 | |
| all | ProtocolType | 3.6.0 | |
| ah | ProtocolType | 3.6.0 | |
| ax.25 | ProtocolType | 3.6.0 | |
| dccp | ProtocolType | 3.6.0 | |
| ddp | ProtocolType | 3.6.0 | |
| egp | ProtocolType | 3.6.0 | |
| eigrp | ProtocolType | 3.6.0 | |
| encap | ProtocolType | 3.6.0 | |
| esp | ProtocolType | 3.6.0 | |
| etherip | ProtocolType | 3.6.0 | |
| fc | ProtocolType | 3.6.0 | |
| ggp | ProtocolType | 3.6.0 | |
| gre | ProtocolType | 3.6.0 | |
| hip | ProtocolType | 3.6.0 | |
| hmp | ProtocolType | 3.6.0 | |
| icmp | ProtocolType | 3.6.0 | |
| ipdr-cmtp | ProtocolType | 3.6.0 | |
| idpr | ProtocolType | 3.6.0 | |
| igmp | ProtocolType | 3.6.0 | |
| igp | ProtocolType | 3.6.0 | |
| ip | ProtocolType | 3.6.0 | |
| ipcomp | ProtocolType | 3.6.0 | |
| ipencap | ProtocolType | 3.6.0 | |
| ipip | ProtocolType | 3.6.0 | |
| isis | ProtocolType | 3.6.0 | |
| iso-tp4 | ProtocolType | 3.6.0 | |
| l2tp | ProtocolType | 3.6.0 | |
| manet | ProtocolType | 3.6.0 | |
| mpls-in-ip | ProtocolType | 3.6.0 | |
| ospf | ProtocolType | 3.6.0 | |
| pim | ProtocolType | 3.6.0 | |
| pup | ProtocolType | 3.6.0 | |
| rdp | ProtocolType | 3.6.0 | |
| rohc | ProtocolType | 3.6.0 | |
| rspf | ProtocolType | 3.6.0 | |
| rsvp | ProtocolType | 3.6.0 | |
| sctp | ProtocolType | 3.6.0 | |
| skip | ProtocolType | 3.6.0 | |
| st | ProtocolType | 3.6.0 | |
| tcp | ProtocolType | 3.6.0 | |
| udp | ProtocolType | 3.6.0 | |
| udplite | ProtocolType | 3.6.0 | |
| vmtp | ProtocolType | 3.6.0 | |
| vrrp | ProtocolType | 3.6.0 | |
| wesp | ProtocolType | 3.6.0 | |
| xns-idp | ProtocolType | 3.6.0 | |
| xtp | ProtocolType | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 3.6.0 | |
| enable | FirewallRuleState | 3.6.0 |
SDK Sample
ChangeFirewallRuleStateAction action = new ChangeFirewallRuleStateAction();
action.uuid = "4eef3024e5bd36f38be22b5af9807b20";
action.state = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeFirewallRuleStateAction.Result res = action.call();ChangeFirewallRuleStateAction action = ChangeFirewallRuleStateAction()
action.uuid = "4eef3024e5bd36f38be22b5af9807b20"
action.state = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeFirewallRuleStateAction.Result res = action.call()CheckFirewallRuleConfigFile
API Request
POST zstack/v1/vpcfirewalls/rules/from-file/checkAuthorization: OAuth the-session-uuid{
"params": {
"ruleInfo": "[{\"ruleNumber\":1004,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ICMP\",\"tcpFlag\":null,\"icmpTypeName\":\"echo-reply\",\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.41\",\"destIp\":\"192.168.0.50\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1003,\"action\":\"reject\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"UDP\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":\"77\",\"destPort\":\"88\",\"sourceIp\":\"192.168.0.31\",\"destIp\":\"192.168.0.40\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1002,\"action\":\"drop\",\"allowStates\":\"new,invalid,related\",\"protocol\":\"TCP\",\"tcpFlag\":\"SYN,ACK\",\"icmpTypeName\":null,\"sourcePort\":\"55\",\"destPort\":\"66\",\"sourceIp\":\"192.168.0.21\",\"destIp\":\"192.168.0.30\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1001,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ALL\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.10\",\"destIp\":\"192.168.0.20\",\"description\":null,\"state\":\"enable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"}]"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"params":{"ruleInfo":"[{\"ruleNumber\":1004,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ICMP\",\"tcpFlag\":null,\"icmpTypeName\":\"echo-reply\",\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.41\",\"destIp\":\"192.168.0.50\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1003,\"action\":\"reject\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"UDP\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":\"77\",\"destPort\":\"88\",\"sourceIp\":\"192.168.0.31\",\"destIp\":\"192.168.0.40\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1002,\"action\":\"drop\",\"allowStates\":\"new,invalid,related\",\"protocol\":\"TCP\",\"tcpFlag\":\"SYN,ACK\",\"icmpTypeName\":null,\"sourcePort\":\"55\",\"destPort\":\"66\",\"sourceIp\":\"192.168.0.21\",\"destIp\":\"192.168.0.30\",\"description\":null,\"state\":\"disable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"},{\"ruleNumber\":1001,\"action\":\"accept\",\"allowStates\":\"new,established,invalid,related\",\"protocol\":\"ALL\",\"tcpFlag\":null,\"icmpTypeName\":null,\"sourcePort\":null,\"destPort\":null,\"sourceIp\":\"192.168.0.10\",\"destIp\":\"192.168.0.20\",\"description\":null,\"state\":\"enable\", \"ruleSetUuid\": \"${defaultRuleSet.uuid}\"}]"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules/from-file/check| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| ruleInfo | String | body (contained in the params structure) | The firewall rule information. | 4.4.0 | |
| systemTags | List | body | Optional. The system tags. | 4.4.0 | |
| userTags | List | body | Optional. The user tags. | 4.4.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
CheckFirewallRuleConfigFileAction action = new CheckFirewallRuleConfigFileAction();
action.ruleInfo = "[{"ruleNumber":1004,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ICMP","tcpFlag":null,"icmpTypeName":"echo-reply","sourcePort":null,"destPort":null,"sourceIp":"192.168.0.41","destIp":"192.168.0.50","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1003,"action":"reject","allowStates":"new,established,invalid,related","protocol":"UDP","tcpFlag":null,"icmpTypeName":null,"sourcePort":"77","destPort":"88","sourceIp":"192.168.0.31","destIp":"192.168.0.40","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1002,"action":"drop","allowStates":"new,invalid,related","protocol":"TCP","tcpFlag":"SYN,ACK","icmpTypeName":null,"sourcePort":"55","destPort":"66","sourceIp":"192.168.0.21","destIp":"192.168.0.30","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1001,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ALL","tcpFlag":null,"icmpTypeName":null,"sourcePort":null,"destPort":null,"sourceIp":"192.168.0.10","destIp":"192.168.0.20","description":null,"state":"enable", "ruleSetUuid": "${defaultRuleSet.uuid}"}]";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckFirewallRuleConfigFileAction.Result res = action.call();CheckFirewallRuleConfigFileAction action = CheckFirewallRuleConfigFileAction()
action.ruleInfo = "[{"ruleNumber":1004,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ICMP","tcpFlag":null,"icmpTypeName":"echo-reply","sourcePort":null,"destPort":null,"sourceIp":"192.168.0.41","destIp":"192.168.0.50","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1003,"action":"reject","allowStates":"new,established,invalid,related","protocol":"UDP","tcpFlag":null,"icmpTypeName":null,"sourcePort":"77","destPort":"88","sourceIp":"192.168.0.31","destIp":"192.168.0.40","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1002,"action":"drop","allowStates":"new,invalid,related","protocol":"TCP","tcpFlag":"SYN,ACK","icmpTypeName":null,"sourcePort":"55","destPort":"66","sourceIp":"192.168.0.21","destIp":"192.168.0.30","description":null,"state":"disable", "ruleSetUuid": "${defaultRuleSet.uuid}"},{"ruleNumber":1001,"action":"accept","allowStates":"new,established,invalid,related","protocol":"ALL","tcpFlag":null,"icmpTypeName":null,"sourcePort":null,"destPort":null,"sourceIp":"192.168.0.10","destIp":"192.168.0.20","description":null,"state":"enable", "ruleSetUuid": "${defaultRuleSet.uuid}"}]"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CheckFirewallRuleConfigFileAction.Result res = action.call()CreateFirewallRuleTemplate
API Request
POST zstack/v1/vpcfirewalls/rules/templateAuthorization: OAuth the-session-uuid{
"params": {
"action": "accept",
"protocol": "tcp",
"name": "rule-template",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"description": "example rule des"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"action":"accept","protocol":"tcp","name":"rule-template","destPort":"22","sourcePort":"22","sourceIp":"192.168.1.2","destIp":"192.168.1.1","allowStates":"invalid,new","tcpFlag":"SYN","icmpTypeName":"echo-reply","ruleNumber":1001.0,"enableLog":false,"state":"disable","description":"example rule des"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules/template| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| action | String | body (contained in the params structure) |
|
4.0.0 | |
| protocol | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| name | String | body (contained in the params structure) | The name of the template. | 4.0.0 | |
| destPort | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| sourcePort | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| sourceIp | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| destIp | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| allowStates | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| tcpFlag | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| icmpTypeName | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| ruleNumber | Integer | body (contained in the params structure) | 4.0.0 | ||
| enableLog | boolean | body (contained in the params structure) | Optional. | 4.0.0 | |
| state | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the template. | 4.0.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The UUID of the template. | 4.0.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The user tags. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 4.0.0 | |
| userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
{
"inventory": {
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"isDefault": false,
"description": "example rule des"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | VpcFirewallRuleTemplateInventory | See inventory | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The name of the template. | 4.0.0 |
| destPort | String | 4.0.0 | |
| sourcePort | String | 4.0.0 | |
| sourceIp | String | 4.0.0 | |
| destIp | String | 4.0.0 | |
| allowStates | String | 4.0.0 | |
| tcpFlag | String | 4.0.0 | |
| icmpTypeName | String | 4.0.0 | |
| ruleNumber | int | 4.0.0 | |
| enableLog | boolean | 4.0.0 | |
| isDefault | boolean | 4.0.0 | |
| description | String | The detailed description of the template. | 4.0.0 |
| createDate | Timestamp | The time when the template was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the template was last modified. | 4.0.0 |
| accountUuid | String | The account UUID. | 4.0.0 |
| uuid | String | The UUID of the template. | 4.0.0 |
| action | ActionType | See action | 4.0.0 |
| protocol | ProtocolType | See protocol | 4.0.0 |
| state | FirewallRuleState | See state | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 4.0.0 | |
| reject | ActionType | 4.0.0 | |
| accept | ActionType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 4.0.0 | |
| all | ProtocolType | 4.0.0 | |
| ah | ProtocolType | 4.0.0 | |
| ax.25 | ProtocolType | 4.0.0 | |
| dccp | ProtocolType | 4.0.0 | |
| ddp | ProtocolType | 4.0.0 | |
| egp | ProtocolType | 4.0.0 | |
| eigrp | ProtocolType | 4.0.0 | |
| encap | ProtocolType | 4.0.0 | |
| esp | ProtocolType | 4.0.0 | |
| etherip | ProtocolType | 4.0.0 | |
| fc | ProtocolType | 4.0.0 | |
| ggp | ProtocolType | 4.0.0 | |
| gre | ProtocolType | 4.0.0 | |
| hip | ProtocolType | 4.0.0 | |
| hmp | ProtocolType | 4.0.0 | |
| icmp | ProtocolType | 4.0.0 | |
| ipdr-cmtp | ProtocolType | 4.0.0 | |
| idpr | ProtocolType | 4.0.0 | |
| igmp | ProtocolType | 4.0.0 | |
| igp | ProtocolType | 4.0.0 | |
| ip | ProtocolType | 4.0.0 | |
| ipcomp | ProtocolType | 4.0.0 | |
| ipencap | ProtocolType | 4.0.0 | |
| ipip | ProtocolType | 4.0.0 | |
| isis | ProtocolType | 4.0.0 | |
| iso-tp4 | ProtocolType | 4.0.0 | |
| l2tp | ProtocolType | 4.0.0 | |
| manet | ProtocolType | 4.0.0 | |
| pls-in-ip | ProtocolType | 4.0.0 | |
| ospf | ProtocolType | 4.0.0 | |
| pim | ProtocolType | 4.0.0 | |
| pup | ProtocolType | 4.0.0 | |
| rdp | ProtocolType | 4.0.0 | |
| rohc | ProtocolType | 4.0.0 | |
| rspf | ProtocolType | 4.0.0 | |
| rsvp | ProtocolType | 4.0.0 | |
| sctp | ProtocolType | 4.0.0 | |
| skip | ProtocolType | 4.0.0 | |
| st | ProtocolType | 4.0.0 | |
| tcp | ProtocolType | 4.0.0 | |
| udp | ProtocolType | 4.0.0 | |
| udplite | ProtocolType | 4.0.0 | |
| vmtp | ProtocolType | 4.0.0 | |
| vrrp | ProtocolType | 4.0.0 | |
| wesp | ProtocolType | 4.0.0 | |
| xns-idp | ProtocolType | 4.0.0 | |
| xtp | ProtocolType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 4.0.0 | |
| enable | FirewallRuleState | 4.0.0 |
SDK Sample
CreateFirewallRuleTemplateAction action = new CreateFirewallRuleTemplateAction();
action.action = "accept";
action.protocol = "tcp";
action.name = "rule-template";
action.destPort = "22";
action.sourcePort = "22";
action.sourceIp = "192.168.1.2";
action.destIp = "192.168.1.1";
action.allowStates = "invalid,new";
action.tcpFlag = "SYN";
action.icmpTypeName = "echo-reply";
action.ruleNumber = 1001.0;
action.enableLog = false;
action.state = "disable";
action.description = "example rule des";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFirewallRuleTemplateAction.Result res = action.call();CreateFirewallRuleTemplateAction action = CreateFirewallRuleTemplateAction()
action.action = "accept"
action.protocol = "tcp"
action.name = "rule-template"
action.destPort = "22"
action.sourcePort = "22"
action.sourceIp = "192.168.1.2"
action.destIp = "192.168.1.1"
action.allowStates = "invalid,new"
action.tcpFlag = "SYN"
action.icmpTypeName = "echo-reply"
action.ruleNumber = 1001.0
action.enableLog = false
action.state = "disable"
action.description = "example rule des"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateFirewallRuleTemplateAction.Result res = action.call()DeleteFirewallRuleTemplate
API Request
DELETE zstack/v1/vpcfirewalls/ipset/templates/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vpcfirewalls/rules/templates/8de197dab6af3e30b7131bc6d50f935d?deleteMode=Permissive| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the rule template. | 4.0.0 | |
| deleteMode | String | body | Optional. The deletion mode. |
|
4.0.0 |
| systemTags | List | body | Optional. The system tags. | 4.0.0 | |
| userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteFirewallRuleTemplateAction action = new DeleteFirewallRuleTemplateAction();
action.uuid = "8de197dab6af3e30b7131bc6d50f935d";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFirewallRuleTemplateAction.Result res = action.call();DeleteFirewallRuleTemplateAction action = DeleteFirewallRuleTemplateAction()
action.uuid = "8de197dab6af3e30b7131bc6d50f935d"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteFirewallRuleTemplateAction.Result res = action.call()UpdateFirewallRuleTemplate
API Request
PUT zstack/v1/vpcfirewalls/rules/template/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateFirewallRuleTemplate": {
"name": "rule-template-name",
"action": "accept",
"protocol": "tcp",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"description": "example rule des"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateFirewallRuleTemplate":{"name":"rule-template-name","action":"accept","protocol":"tcp","destPort":"22","sourcePort":"22","sourceIp":"192.168.1.2","destIp":"192.168.1.1","allowStates":"invalid,new","tcpFlag":"SYN","icmpTypeName":"echo-reply","ruleNumber":1001.0,"enableLog":false,"state":"disable","description":"example rule des"}}' http://localhost:8080/zstack/v1/vpcfirewalls/rules/template/0e85a35457763de9bc0a4d19d15e4630/actions| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the template. | 4.0.0 | |
| name | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. The name of the rule template. | 4.0.0 | |
| action | String | body (contained in theupdateFirewallRuleTemplate structure) |
|
4.0.0 | |
| protocol | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| destPort | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| sourcePort | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| sourceIp | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| destIp | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| allowStates | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| tcpFlag | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| icmpTypeName | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| ruleNumber | Integer | body (contained in theupdateFirewallRuleTemplate structure) | 4.0.0 | ||
| enableLog | boolean | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| state | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. | 4.0.0 | |
| description | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. The detailed description of the template. | 4.0.0 | |
| resourceUuid | String | body (contained in theupdateFirewallRuleTemplate structure) | Optional. The UUID of the template. | 4.0.0 | |
| tagUuids | List | body (contained in theupdateFirewallRuleTemplate structure) | Optional. The tag tags. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 4.0.0 | |
| userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
{
"inventory": {
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"isDefault": false,
"description": "example rule des"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | VpcFirewallRuleTemplateInventory | See inventory | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The name of the template. | 4.0.0 |
| destPort | String | 4.0.0 | |
| sourcePort | String | 4.0.0 | |
| sourceIp | String | 4.0.0 | |
| destIp | String | 4.0.0 | |
| allowStates | String | 4.0.0 | |
| tcpFlag | String | 4.0.0 | |
| icmpTypeName | String | 4.0.0 | |
| ruleNumber | int | 4.0.0 | |
| enableLog | boolean | 4.0.0 | |
| isDefault | boolean | 4.0.0 | |
| description | String | The detailed description of the template. | 4.0.0 |
| createDate | Timestamp | The time when the template was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the template was last modified. | 4.0.0 |
| accountUuid | String | The account UUID. | 4.0.0 |
| uuid | String | The UUID of the template. | 4.0.0 |
| action | ActionType | See action | 4.0.0 |
| protocol | ProtocolType | See protocol | 4.0.0 |
| state | FirewallRuleState | See state | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 4.0.0 | |
| reject | ActionType | 4.0.0 | |
| accept | ActionType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 4.0.0 | |
| all | ProtocolType | 4.0.0 | |
| ah | ProtocolType | 4.0.0 | |
| ax.25 | ProtocolType | 4.0.0 | |
| dccp | ProtocolType | 4.0.0 | |
| ddp | ProtocolType | 4.0.0 | |
| egp | ProtocolType | 4.0.0 | |
| eigrp | ProtocolType | 4.0.0 | |
| encap | ProtocolType | 4.0.0 | |
| esp | ProtocolType | 4.0.0 | |
| etherip | ProtocolType | 4.0.0 | |
| fc | ProtocolType | 4.0.0 | |
| ggp | ProtocolType | 4.0.0 | |
| gre | ProtocolType | 4.0.0 | |
| hip | ProtocolType | 4.0.0 | |
| hmp | ProtocolType | 4.0.0 | |
| icmp | ProtocolType | 4.0.0 | |
| ipdr-cmtp | ProtocolType | 4.0.0 | |
| idpr | ProtocolType | 4.0.0 | |
| igmp | ProtocolType | 4.0.0 | |
| igp | ProtocolType | 4.0.0 | |
| ip | ProtocolType | 4.0.0 | |
| ipcomp | ProtocolType | 4.0.0 | |
| ipencap | ProtocolType | 4.0.0 | |
| ipip | ProtocolType | 4.0.0 | |
| isis | ProtocolType | 4.0.0 | |
| iso-tp4 | ProtocolType | 4.0.0 | |
| l2tp | ProtocolType | 4.0.0 | |
| manet | ProtocolType | 4.0.0 | |
| pls-in-ip | ProtocolType | 4.0.0 | |
| ospf | ProtocolType | 4.0.0 | |
| pim | ProtocolType | 4.0.0 | |
| pup | ProtocolType | 4.0.0 | |
| rdp | ProtocolType | 4.0.0 | |
| rohc | ProtocolType | 4.0.0 | |
| rspf | ProtocolType | 4.0.0 | |
| rsvp | ProtocolType | 4.0.0 | |
| sctp | ProtocolType | 4.0.0 | |
| skip | ProtocolType | 4.0.0 | |
| st | ProtocolType | 4.0.0 | |
| tcp | ProtocolType | 4.0.0 | |
| udp | ProtocolType | 4.0.0 | |
| udplite | ProtocolType | 4.0.0 | |
| vmtp | ProtocolType | 4.0.0 | |
| vrrp | ProtocolType | 4.0.0 | |
| wesp | ProtocolType | 4.0.0 | |
| xns-idp | ProtocolType | 4.0.0 | |
| xtp | ProtocolType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 4.0.0 | |
| enable | FirewallRuleState | 4.0.0 |
SDK Sample
UpdateFirewallRuleTemplateAction action = new UpdateFirewallRuleTemplateAction();
action.uuid = "0e85a35457763de9bc0a4d19d15e4630";
action.name = "rule-template-name";
action.action = "accept";
action.protocol = "tcp";
action.destPort = "22";
action.sourcePort = "22";
action.sourceIp = "192.168.1.2";
action.destIp = "192.168.1.1";
action.allowStates = "invalid,new";
action.tcpFlag = "SYN";
action.icmpTypeName = "echo-reply";
action.ruleNumber = 1001.0;
action.enableLog = false;
action.state = "disable";
action.description = "example rule des";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateFirewallRuleTemplateAction.Result res = action.call();UpdateFirewallRuleTemplateAction action = UpdateFirewallRuleTemplateAction()
action.uuid = "0e85a35457763de9bc0a4d19d15e4630"
action.name = "rule-template-name"
action.action = "accept"
action.protocol = "tcp"
action.destPort = "22"
action.sourcePort = "22"
action.sourceIp = "192.168.1.2"
action.destIp = "192.168.1.1"
action.allowStates = "invalid,new"
action.tcpFlag = "SYN"
action.icmpTypeName = "echo-reply"
action.ruleNumber = 1001.0
action.enableLog = false
action.state = "disable"
action.description = "example rule des"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateFirewallRuleTemplateAction.Result res = action.call()QueryFirewallRuleTemplate
API Request
GET zstack/v1/vpcfirewalls/rules/templates
GET zstack/v1/vpcfirewalls/rules/templates/uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/rules/templatescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/rules/templates/uuid}Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryFirewallRuleTemplate, and pressing the Tab key.
API Response
{
"inventories": [
{
"action": "accept",
"protocol": "TCP",
"destPort": "22",
"sourcePort": "22",
"sourceIp": "192.168.1.2",
"destIp": "192.168.1.1",
"allowStates": "invalid,new",
"tcpFlag": "SYN",
"icmpTypeName": "echo-reply",
"ruleNumber": 1001.0,
"enableLog": false,
"state": "disable",
"isDefault": false,
"description": "example rule des"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | List | See inventories | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The name of the template. | 4.0.0 |
| destPort | String | 4.0.0 | |
| sourcePort | String | 4.0.0 | |
| sourceIp | String | 4.0.0 | |
| destIp | String | 4.0.0 | |
| allowStates | String | 4.0.0 | |
| tcpFlag | String | 4.0.0 | |
| icmpTypeName | String | 4.0.0 | |
| ruleNumber | int | 4.0.0 | |
| enableLog | boolean | 4.0.0 | |
| isDefault | boolean | 4.0.0 | |
| description | String | The detailed description of the template. | 4.0.0 |
| createDate | Timestamp | The time when the template was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the rule template was last modified. | 4.0.0 |
| accountUuid | String | The account UUID. | 4.0.0 |
| uuid | String | The UUID of the template. | 4.0.0 |
| action | ActionType | See action | 4.0.0 |
| protocol | ProtocolType | See protocol | 4.0.0 |
| state | FirewallRuleState | See state | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 4.0.0 | |
| reject | ActionType | 4.0.0 | |
| accept | ActionType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp_udp | ProtocolType | 4.0.0 | |
| all | ProtocolType | 4.0.0 | |
| ah | ProtocolType | 4.0.0 | |
| ax.25 | ProtocolType | 4.0.0 | |
| dccp | ProtocolType | 4.0.0 | |
| ddp | ProtocolType | 4.0.0 | |
| egp | ProtocolType | 4.0.0 | |
| eigrp | ProtocolType | 4.0.0 | |
| encap | ProtocolType | 4.0.0 | |
| esp | ProtocolType | 4.0.0 | |
| etherip | ProtocolType | 4.0.0 | |
| fc | ProtocolType | 4.0.0 | |
| ggp | ProtocolType | 4.0.0 | |
| gre | ProtocolType | 4.0.0 | |
| hip | ProtocolType | 4.0.0 | |
| hmp | ProtocolType | 4.0.0 | |
| icmp | ProtocolType | 4.0.0 | |
| ipdr-cmtp | ProtocolType | 4.0.0 | |
| idpr | ProtocolType | 4.0.0 | |
| igmp | ProtocolType | 4.0.0 | |
| igp | ProtocolType | 4.0.0 | |
| ip | ProtocolType | 4.0.0 | |
| ipcomp | ProtocolType | 4.0.0 | |
| ipencap | ProtocolType | 4.0.0 | |
| ipip | ProtocolType | 4.0.0 | |
| isis | ProtocolType | 4.0.0 | |
| iso-tp4 | ProtocolType | 4.0.0 | |
| l2tp | ProtocolType | 4.0.0 | |
| manet | ProtocolType | 4.0.0 | |
| pls-in-ip | ProtocolType | 4.0.0 | |
| ospf | ProtocolType | 4.0.0 | |
| pim | ProtocolType | 4.0.0 | |
| pup | ProtocolType | 4.0.0 | |
| rdp | ProtocolType | 4.0.0 | |
| rohc | ProtocolType | 4.0.0 | |
| rspf | ProtocolType | 4.0.0 | |
| rsvp | ProtocolType | 4.0.0 | |
| sctp | ProtocolType | 4.0.0 | |
| skip | ProtocolType | 4.0.0 | |
| st | ProtocolType | 4.0.0 | |
| tcp | ProtocolType | 4.0.0 | |
| udp | ProtocolType | 4.0.0 | |
| udplite | ProtocolType | 4.0.0 | |
| vmtp | ProtocolType | 4.0.0 | |
| vrrp | ProtocolType | 4.0.0 | |
| wesp | ProtocolType | 4.0.0 | |
| xns-idp | ProtocolType | 4.0.0 | |
| xtp | ProtocolType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| disable | FirewallRuleState | 4.0.0 | |
| enable | FirewallRuleState | 4.0.0 |
SDK Sample
QueryFirewallRuleTemplateAction action = new QueryFirewallRuleTemplateAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFirewallRuleTemplateAction.Result res = action.call();QueryFirewallRuleTemplateAction action = QueryFirewallRuleTemplateAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFirewallRuleTemplateAction.Result res = action.call()QueryVpcFirewallVRouterRef
API Request
GET zstack/v1/vpcfirewalls/vrouters/refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/vrouters/refs?Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVpcFirewallVRouterRef, and pressing the Tab key.
API Response
{
"inventories": [
{
"id": 1.0,
"vpcFirewallUuid": "cd7ab20e4768316c86230f2d982ae5a5",
"vRouterUuid": "7013faeb3b4736d1800749b1e910a845",
"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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| vpcFirewallUuid | String | 3.6.0 | |
| vRouterUuid | String | 3.6.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
QueryVpcFirewallVRouterRefAction action = new QueryVpcFirewallVRouterRefAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVpcFirewallVRouterRefAction.Result res = action.call();QueryVpcFirewallVRouterRefAction action = QueryVpcFirewallVRouterRefAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVpcFirewallVRouterRefAction.Result res = action.call()ApplyRuleSetChanges
API Request
PUT zstack/v1/vpcfirewalls/ruleSets/apply/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"applyRuleSetChanges": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"applyRuleSetChanges":{}}' http://localhost:8080/zstack/v1/vpcfirewalls/ruleSets/apply/e78b0b5ebe1c33159b0faa2d88a41b21/actions| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the action. | 4.0.0 | |
| systemTags | List | body | Optional. | 4.0.0 | |
| userTags | List | body | Optional. | 4.0.0 |
API Response
{
"inventory": {
"name": "name",
"actionType": "drop",
"description": "example-des",
"enableDefaultLog": false,
"isDefault": false,
"isApplied": true
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | VpcFirewallRuleSetInventory | See inventory | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the VPC firewall ruleset. | 4.0.0 |
| name | String | The name of the VPC firewall ruleset. | 4.0.0 |
| description | String | The detailed description of the VPC firewall ruleset. | 4.0.0 |
| isDefault | boolean | 4.0.0 | |
| isApplied | boolean | 4.0.0 | |
| createDate | Timestamp | The time when the VPC firewall ruleset was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the VPC firewall ruleset was last modified. | 4.0.0 |
| actionType | ActionType | See actionType | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| drop | ActionType | 4.0.0 | |
| reject | ActionType | 4.0.0 | |
| accept | ActionType | 4.0.0 |
SDK Sample
ApplyRuleSetChangesAction action = new ApplyRuleSetChangesAction();
action.uuid = "e78b0b5ebe1c33159b0faa2d88a41b21";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ApplyRuleSetChangesAction.Result res = action.call();ApplyRuleSetChangesAction action = ApplyRuleSetChangesAction()
action.uuid = "e78b0b5ebe1c33159b0faa2d88a41b21"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ApplyRuleSetChangesAction.Result res = action.call()CreateFirewallIpSetTemplate
API Request
POST zstack/v1/vpcfirewalls/ipset/templatesAuthorization: OAuth the-session-uuid{
"params": {
"name": "ipset-template",
"sourceValue": "192.168.1.2",
"destValue": "192.168.1.1,10.0.0.1/24",
"type": "ip"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"ipset-template","sourceValue":"192.168.1.2","destValue":"192.168.1.1,10.0.0.1/24","type":"ip"}}' http://localhost:8080/zstack/v1/vpcfirewalls/ipset/templates| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name of the template. | 4.0.0 | |
| sourceValue | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| destValue | String | body (contained in the params structure) | Optional. | 4.0.0 | |
| type | IpSetType | body (contained in the params structure) |
|
4.0.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The UUID of the template. | 4.0.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The user tags. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 4.0.0 | |
| userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
{
"inventory": {
"name": "ipset-template",
"sourceValue": "192.168.1.2",
"destValue": "192.168.1.1,10.0.0.1/24",
"type": "ip"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | VpcFirewallIpSetTemplateInventory | See inventory | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The name of the template. | 4.0.0 |
| sourceValue | String | 4.0.0 | |
| destValue | String | 4.0.0 | |
| createDate | Timestamp | The time when the template was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the template was last modified. | 4.0.0 |
| accountUuid | String | The account UUID. | 4.0.0 |
| uuid | String | The template UUID. | 4.0.0 |
| type | IpSetType | See type | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ip | IpSetType | 4.0.0 | |
| port | IpSetType | 4.0.0 |
SDK Sample
CreateFirewallIpSetTemplateAction action = new CreateFirewallIpSetTemplateAction();
action.name = "ipset-template";
action.sourceValue = "192.168.1.2";
action.destValue = "192.168.1.1,10.0.0.1/24";
action.type = "ip";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFirewallIpSetTemplateAction.Result res = action.call();CreateFirewallIpSetTemplateAction action = CreateFirewallIpSetTemplateAction()
action.name = "ipset-template"
action.sourceValue = "192.168.1.2"
action.destValue = "192.168.1.1,10.0.0.1/24"
action.type = "ip"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateFirewallIpSetTemplateAction.Result res = action.call()DeleteFirewallIpSetTemplate
API Request
DELETE /v1/vpcfirewalls/ipset/templates/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X DELETE http://localhost:8080/zstack/v1/vpcfirewalls/ipset/templates/e84fbe6b5a9c31a1b4b83cfde4028893?deleteMode=Permissive| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the template. | 4.0.0 | |
| deleteMode | String | body | Optional. The deletion mode. |
|
4.0.0 |
| Optional. The system tags. | List | body | Optional. The system tags. | 4.0.0 | |
| Optional. The user tags. | List | body | Optional. The user tags. | 4.0.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteFirewallIpSetTemplateAction action = new DeleteFirewallIpSetTemplateAction();
action.uuid = "e84fbe6b5a9c31a1b4b83cfde4028893";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFirewallIpSetTemplateAction.Result res = action.call();DeleteFirewallIpSetTemplateAction action = DeleteFirewallIpSetTemplateAction()
action.uuid = "e84fbe6b5a9c31a1b4b83cfde4028893"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteFirewallIpSetTemplateAction.Result res = action.call()UpdateFirewallIpSetTemplate
API Request
PUT zstack/v1/vpcfirewalls/ipset/templates/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateFirewallIpSetTemplate": {
"name": "ipset-template",
"sourceValue": "192.168.1.2",
"destValue": "192.168.1.1,10.0.0.1/24",
"type": "ip"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateFirewallIpSetTemplate":{"name":"ipset-template","sourceValue":"192.168.1.2","destValue":"192.168.1.1,10.0.0.1/24","type":"ip"}}' http://localhost:8080/zstack/v1/vpcfirewalls/ipset/templates/c7df801f021e334f9d548eac2eb2cd47/actions| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the template. | 4.0.0 | |
| name | String | body (contained in the updateFirewallIpSetTemplate structure) | Optional. The name of the template. | 4.0.0 | |
| sourceValue | String | body (contained in the updateFirewallIpSetTemplate structure) | Optional. | 4.0.0 | |
| destValue | String | body (contained in the updateFirewallIpSetTemplate structure) | Optional. | 4.0.0 | |
| type | IpSetType | body (contained in the updateFirewallIpSetTemplate structure) |
|
4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 4.0.0 | |
| userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
{
"inventory": {
"name": "ipset-template",
"sourceValue": "192.168.1.2",
"destValue": "192.168.1.1,10.0.0.1/24",
"type": "ip"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | VpcFirewallRuleTemplateInventory | See inventory | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The name of the template. | 4.0.0 |
| sourceValue | String | 4.0.0 | |
| destValue | String | 4.0.0 | |
| createDate | Timestamp | The time when the template was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the template was last modified. | 4.0.0 |
| accountUuid | String | The account UUID. | 4.0.0 |
| uuid | String | The UUID of the template. | 4.0.0 |
| type | IpSetType | See type | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ip | IpSetType | 4.0.0 | |
| port | IpSetType | 4.0.0 |
SDK Sample
UpdateFirewallIpSetTemplateAction action = new UpdateFirewallIpSetTemplateAction();
action.uuid = "c7df801f021e334f9d548eac2eb2cd47";
action.name = "ipset-template";
action.sourceValue = "192.168.1.2";
action.destValue = "192.168.1.1,10.0.0.1/24";
action.type = "ip";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateFirewallIpSetTemplateAction.Result res = action.call();UpdateFirewallIpSetTemplateAction action = UpdateFirewallIpSetTemplateAction()
action.uuid = "c7df801f021e334f9d548eac2eb2cd47"
action.name = "ipset-template"
action.sourceValue = "192.168.1.2"
action.destValue = "192.168.1.1,10.0.0.1/24"
action.type = "ip"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateFirewallIpSetTemplateAction.Result res = action.call()QueryFirewallIpSetTemplate
API Request
GET zstack/v1/vpcfirewalls/ipset/templates
GET zstack/v1/vpcfirewalls/ipset/templates/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/ipset/templatescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/ipset/templates/fe6b68e5315035d88b02dd423de0342cQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryFirewallIpSetTemplate, and pressing the Tab key.
API Response
{
"inventories": [
{
"name": "ipset-template",
"sourceValue": "192.168.1.2",
"destValue": "192.168.1.1,10.0.0.1/24",
"type": "ip"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
| inventory | VpcFirewallIpSetTemplateInventory | See inventories | 4.0.0 |
| 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. | 4.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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. | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | long | The name of the template. | 4.0.0 |
| sourceValue | String | 4.0.0 | |
| destValue | String | 4.0.0 | |
| createDate | Timestamp | The time when the template was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the template was last modified. | 4.0.0 |
| accountUuid | String | The account UUID | 4.0.0 |
| uuid | String | The template UUID. | 4.0.0 |
| type | IpSetType | See type | 4.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ip | IpSetType | 4.0.0 | |
| port | IpSetType | 4.0.0 |
SDK Sample
QueryFirewallIpSetTemplateAction action = new QueryFirewallIpSetTemplateAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFirewallIpSetTemplateAction.Result res = action.call();QueryFirewallIpSetTemplateAction action = QueryFirewallIpSetTemplateAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFirewallIpSetTemplateAction.Result res = action.call()