Network ServicesSecurity Group

ValidateSecurityGroupRule

GET/zstack/v1/security-groups/{securityGroupUuid}/rules/validation

Headers

Authorization: OAuth the-session-uuid

Curl 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=ACCEPT

Parameter 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

  • Ingress
  • Egress

4.7.21

protocol

String

query

The protocol type of the security group rule

  • TCP
  • UDP
  • ICMP
  • ALL

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
  • 6

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

  • ACCEPT
  • DROP

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"
}
NameTypeDescriptionStarting Version
availablebooleanWhether the rule is available4.7.21
codeStringThe rule validation error code4.7.21
reasonStringThe reason4.7.21
successboolean 4.7.21
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See error4.7.21

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10014.7.21
descriptionStringBrief description of the error4.7.21
detailsStringDetailed error information4.7.21
elaborationStringReserved field, defaults to null4.7.21
opaqueLinkedHashMapReserved field, defaults to null4.7.21
causeErrorCodeRoot error: the source error that caused the current error. If there is no original error, this field is null4.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()