ValidateSecurityGroupRule
Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X GET http://localhost:8080/zstack/v1/security-groups/0351d8b796bd3165967f13d1da2f9576/rules/validation?type=Ingress&protocol=TCP&remoteSecurityGroupUuid=f938bc96baae3dc4b18be6bdbf34e783&ipVersion=4&srcIpRange=10.0.0.1,10.0.0.2-10.0.0.200,10.1.1.0/24&dstIpRange=10.0.0.1,10.0.0.2-10.0.0.200,10.1.1.0/24&dstPortRange=1000,1001,1002-1005,1008&action=ACCEPTParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
securityGroupUuid | String | url | The UUID of the security group, uniquely identifying the resource |
| 4.7.21 |
type | String | query | The direction of the security group rule |
| 4.7.21 |
protocol | String | query | The protocol type of the security group rule |
| 4.7.21 |
remoteSecurityGroupUuid (Optional) | String | query | The UUID of the remote security group, uniquely identifying the resource |
| 4.7.21 |
ipVersion (Optional) | Integer | query | The IP version of the security group rule |
| 4.7.21 |
srcIpRange (Optional) | String | query | The source IP range of the security group rule |
| 4.7.21 |
dstIpRange (Optional) | String | query | The destination IP range of the security group rule |
| 4.7.21 |
dstPortRange (Optional) | String | query | The destination port range of the security group rule |
| 4.7.21 |
action (Optional) | String | query | The action of the security group rule |
| 4.7.21 |
startPort (Optional) | Integer | query | The start port of the security group rule |
| 4.7.21 |
endPort (Optional) | Integer | query | The end port of the security group rule |
| 4.7.21 |
allowedCidr (Optional) | String | query | The IP range of the security group rule |
| 4.7.21 |
systemTags (Optional) | List | body | System tags |
| 4.7.21 |
userTags (Optional) | List | body | User tags |
| 4.7.21 |
API Response
Response Example
{
"available": true,
"code": "SG.2000"
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| available | boolean | Whether the rule is available | 4.7.21 |
| code | String | The rule validation error code | 4.7.21 |
| reason | String | The reason | 4.7.21 |
| success | boolean | 4.7.21 | |
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See error | 4.7.21 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001 | 4.7.21 |
| description | String | Brief description of the error | 4.7.21 |
| details | String | Detailed error information | 4.7.21 |
| elaboration | String | Reserved field, defaults to null | 4.7.21 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 4.7.21 |
| cause | ErrorCode | Root error: the source error that caused the current error. If there is no original error, this field is null | 4.7.21 |
SDK Examples
Java SDK
ValidateSecurityGroupRuleAction action = new ValidateSecurityGroupRuleAction();
action.securityGroupUuid = "0351d8b796bd3165967f13d1da2f9576";
action.type = "Ingress";
action.protocol = "TCP";
action.remoteSecurityGroupUuid = "f938bc96baae3dc4b18be6bdbf34e783";
action.ipVersion = 4;
action.srcIpRange = "10.0.0.1,10.0.0.2-10.0.0.200,10.1.1.0/24";
action.dstIpRange = "10.0.0.1,10.0.0.2-10.0.0.200,10.1.1.0/24";
action.dstPortRange = "1000,1001,1002-1005,1008";
action.action = "ACCEPT";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ValidateSecurityGroupRuleAction.Result res = action.call();Python SDK
ValidateSecurityGroupRuleAction action = ValidateSecurityGroupRuleAction()
action.securityGroupUuid = "0351d8b796bd3165967f13d1da2f9576"
action.type = "Ingress"
action.protocol = "TCP"
action.remoteSecurityGroupUuid = "f938bc96baae3dc4b18be6bdbf34e783"
action.ipVersion = 4
action.srcIpRange = "10.0.0.1,10.0.0.2-10.0.0.200,10.1.1.0/24"
action.dstIpRange = "10.0.0.1,10.0.0.2-10.0.0.200,10.1.1.0/24"
action.dstPortRange = "1000,1001,1002-1005,1008"
action.action = "ACCEPT"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ValidateSecurityGroupRuleAction.Result res = action.call()