Network ServicesSecurity Group

UpdateSecurityGroupRulePriority

PUT/zstack/v1/security-groups/{securityGroupUuid}/rules/priority/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateSecurityGroupRulePriority": {
    "type": "Ingress",
    "rules": [
      {
        "ruleUuid": "7a73154d5d2331308f462c6bf2f725cb",
        "priority": 1
      }
    ]
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. They are listed here to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X PUT -d '{"updateSecurityGroupRulePriority":{"type":"Ingress","rules":[{"ruleUuid":"7a73154d5d2331308f462c6bf2f725cb","priority":1}]}}'
http://localhost:8080/zstack/v1/security-groups/ea321fd5d0f7388e8efd4427c9fae15f/rules/priority/actions

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

body (included in the updateSecurityGroupRulePriority structure)

The type of the rule

  • Ingress
  • Egress

4.7.21

rules

List

body (included in the updateSecurityGroupRulePriority structure)

The rule priorities

 

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

{
  "inventory": {
    "uuid": "777dbc5ec0cb3b14828096daa9e04133",
    "name": "test",
    "internalId": 0
  }
}
NameTypeDescriptionStarting Version
successboolean 4.7.21
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See error4.7.21
inventorySecurityGroupInventorySee inventory4.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

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource, uniquely identifying the resource4.7.21
nameStringThe resource name4.7.21
descriptionStringThe detailed description of the resource4.7.21
stateString 4.7.21
ipVersionIntegerThe IP version number3.1.0
createDateTimestampThe creation time4.7.21
lastOpDateTimestampThe last modification time4.7.21
attachedL3NetworkUuidsSet 4.7.21
rulesListSee rules4.7.21

rules

Name

Type

Description

Starting Version

uuid

String

The UUID of the resource, uniquely identifying the resource

4.7.21

securityGroupUuid

String

The security group UUID

4.7.21

type

String

The traffic type

4.7.21

ipVersion

Integer

The IP version number

3.1.0

protocol

String

The traffic protocol type

4.7.21

state

String

The availability state of the rule

4.7.21

priority

Integer

The rule priority

4.7.21

description

String

The rule description

4.7.21

srcIpRange

String

The source IP range

4.7.21

dstIpRange

String

The destination IP range

4.7.21

srcPortRange

String

The source port range, not implemented in the current version

4.7.21

dstPortRange

String

The destination port range

4.7.21

action

String

The default action of the rule

4.7.21

remoteSecurityGroupUuid

String

 

4.7.21

allowedCidr

String

The allowed CIDR. The meaning of the allowed CIDR varies depending on the traffic type- For Ingress traffic, the allowed CIDR is the source CIDR that is permitted to access the VM NIC

  • For Egress traffic, the allowed CIDR is the destination CIDR that traffic from the VM NIC is permitted to reach

4.7.21

startPort

Integer

  • For TCP/UDP, it is the start port number of the port range
  • For ICMP, it is the ICMP type

4.7.21

endPort

Integer

  • For TCP/UDP, it is the end port number of the port range
  • For ICMP, it is the ICMP type

4.7.21

createDate

Timestamp

The creation time

4.7.21

lastOpDate

Timestamp

The last modification time

4.7.21

SDK Examples

Java SDK

UpdateSecurityGroupRulePriorityAction action = new UpdateSecurityGroupRulePriorityAction();
action.securityGroupUuid = "ea321fd5d0f7388e8efd4427c9fae15f";
action.type = "Ingress";
action.rules = asList([ruleUuid:7a73154d5d2331308f462c6bf2f725cb, priority:1]);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSecurityGroupRulePriorityAction.Result res = action.call();

Python SDK

UpdateSecurityGroupRulePriorityAction action = UpdateSecurityGroupRulePriorityAction()
action.securityGroupUuid = "ea321fd5d0f7388e8efd4427c9fae15f"
action.type = "Ingress"
action.rules = [[ruleUuid:7a73154d5d2331308f462c6bf2f725cb, priority:1]]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSecurityGroupRulePriorityAction.Result res = action.call()