Network ServicesSecurity Group

ChangeVmNicSecurityPolicy

PUT/zstack/v1/security-groups/nics/{vmNicUuid}/security-policy/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeVmNicSecurityPolicy": {
    "ingressPolicy": "ALLOW",
    "egressPolicy": "DENY"
  },
  "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 '{"changeVmNicSecurityPolicy":{"ingressPolicy":"ALLOW","egressPolicy":"DENY"}}'
http://localhost:8080/zstack/v1/security-groups/nics/5551303bee7037c8848cdb5741be7ff7/security-policy/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

vmNicUuid

String

url

The UUID of the NIC, uniquely identifying the resource

 

4.7.21

ingressPolicy (Optional)

String

body (included in the changeVmNicSecurityPolicy structure)

The ingress security policy of the NIC

  • DENY
  • ALLOW

4.7.21

egressPolicy (Optional)

String

body (included in the changeVmNicSecurityPolicy structure)

The egress security policy of the NIC

  • DENY
  • ALLOW

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": "2c8164f7e3213f1491640a2f98d0a979",
    "vmNicUuid": "c731cb960eb635a997e58d154d3c4252",
    "ingressPolicy": "DENY",
    "egressPolicy": "ALLOW",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
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
vmNicUuidStringThe VM NIC UUID4.7.21
ingressPolicyStringThe ingress security policy of the NIC4.7.21
egressPolicyStringThe egress security policy of the NIC4.7.21
createDateTimestampThe creation time4.7.21
lastOpDateTimestampThe last modification time4.7.21

SDK Examples

Java SDK

ChangeVmNicSecurityPolicyAction action = new ChangeVmNicSecurityPolicyAction();
action.vmNicUuid = "5551303bee7037c8848cdb5741be7ff7";
action.ingressPolicy = "ALLOW";
action.egressPolicy = "DENY";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVmNicSecurityPolicyAction.Result res = action.call();

Python SDK

ChangeVmNicSecurityPolicyAction action = ChangeVmNicSecurityPolicyAction()
action.vmNicUuid = "5551303bee7037c8848cdb5741be7ff7"
action.ingressPolicy = "ALLOW"
action.egressPolicy = "DENY"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeVmNicSecurityPolicyAction.Result res = action.call()