Update Firewall Rules - UpdateFirewall
Overview
Update Firewall Rules
ℹ️ When updating firewall rules, the new rules will overwrite the original rules. Therefore, if you need to change or add new rules, you need to submit all original rules together with the new rules.
Definition
Public Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
Action | string | Corresponding API command name, the current API is UpdateFirewall . | Yes |
PublicKey | string | The user's public key can be obtained from Console (opens in a new tab) | Yes |
Signature | string | User signature generated based on public key and API command, see Signature Algorithm | Yes |
Request Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
Region | string | Region. See List of Regions and Availability Zones | Yes |
ProjectId | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface. | No |
FWId | string | Firewall Resource ID | Yes |
Rule.N | string | Firewall rules, for example: TCP|22|192.168.1.1/22|DROP|LOW|Disable port 22, the first parameter represents the protocol: the second parameter represents the port number, the third parameter is the IP, the fourth parameter is ACCEPT (accept) and DROP (reject), the fifth parameter is the priority: HIGH (high), MEDIUM (medium), LOW (low), the sixth parameter is the custom note for this rule, the maximum length of the note is 64. | Yes |
Response Field
Field Name | Type | Description Information | Required |
---|---|---|---|
RetCode | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. | Yes |
Action | string | Operation command name. | Yes |
Message | string | Returns an error message, providing detailed description when RetCode is non-zero. | No |
FWId | string | Firewall id | No |
Example
Request Example
https://api.surfercloud.com/?Action=UpdateFirewall
&ProjectId=org-xxx
&Region=xxxx
&FWId=fw-xxxx
&Rule.1=UDP|53|0.0.0.0/0|ACCEPT|HIGH|Notes
&Rule.0=TCP|3306|0.0.0.0/0|DROP|HIGH|Notes
Response Example
{
"Action": "UpdateFirewallResponse",
"FWId": "firewall-xxx",
"RetCode": 0
}