UpdateFirewallRuleTemplate
API Request
URLs
PUT zstack/v1/vpcfirewalls/rules/template/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"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 Sample
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/actionsRequest Parameters
| 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
Sample 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 |
#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 |
#inventory
| 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 |
#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
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();Python
SDK
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()