QueryFirewallRuleTemplate
API Request
URLs
GET zstack/v1/vpcfirewalls/rules/templates
GET zstack/v1/vpcfirewalls/rules/templates/uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpcfirewalls/rules/templates
curl -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
Sample 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 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 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 |
#inventories
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 |
#action
Name | Type | Description | Starting Version |
---|---|---|---|
drop | ActionType | 4.0.0 | |
reject | ActionType | 4.0.0 | |
accept | ActionType | 4.0.0 |
#protocol
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 |
#state
Name | Type | Description | Starting Version |
---|---|---|---|
disable | FirewallRuleState | 4.0.0 | |
enable | FirewallRuleState | 4.0.0 |
SDK Sample
Java
SDK
QueryFirewallRuleTemplateAction action = new QueryFirewallRuleTemplateAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFirewallRuleTemplateAction.Result res = action.call();
Python
SDK
QueryFirewallRuleTemplateAction action = QueryFirewallRuleTemplateAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFirewallRuleTemplateAction.Result res = action.call()