Skip to main content
Network Management/Network Services/Security Group
POSTSecurity GroupSince 0.6SynchronousAuth Required

AddSecurityGroupRule

AddSecurityGroupRule

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Path Parameters

Request Inputs

Path Parameters

  • securityGroupUuidStringRequired

    The security group UUID

Body Fields

  • rulesListRequired

    The rules in the security group

  • remoteSecurityGroupUuidsList

    The remote security group UUIDs for inter-group policies

  • priorityInteger

    The rule priority

  • systemTagsList

    System tags

  • userTagsList

    User tags

Responses

200 OK

On success, this API returns the following response structure.

  • successbooleanRequired

    操作是否成功。

  • errorErrorCodeRequired

    Error code. If not null, the operation failed. If null, the operation succeeded. See error

    • codeStringRequired

      Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001

    • descriptionStringRequired

      Brief description of the error

    • detailsStringRequired

      Detailed error information

    • elaborationStringRequired

      Reserved field, defaults to null

    • opaqueLinkedHashMapRequired

      Reserved field, defaults to null

    • causeErrorCodeRequired

      Root error: the source error that caused the current error. If there is no original error, this field is null

  • inventorySecurityGroupInventoryRequired

    See inventory

    • uuidStringRequired

      The UUID of the resource, uniquely identifying the resource

    • nameStringRequired

      The resource name

    • descriptionStringRequired

      The detailed description of the resource

    • stateStringRequired

      当前状态。

    • ipVersionIntegerRequired

      The IP version number

    • createDateTimestampRequired

      The creation time

    • lastOpDateTimestampRequired

      The last modification time

    • attachedL3NetworkUuidsSetRequired

      No description provided.

    • rulesListRequired

      See rules

      • uuidStringRequired

        The UUID of the resource, uniquely identifying the resource

      • securityGroupUuidStringRequired

        The security group UUID

      • typeStringRequired

        The traffic type

      • ipVersionIntegerRequired

        The IP version number

      • protocolStringRequired

        The traffic protocol type

      • stateStringRequired

        The availability state of the rule

      • priorityIntegerRequired

        The rule priority

      • descriptionStringRequired

        The rule description

      • srcIpRangeStringRequired

        The source IP range

      • dstIpRangeStringRequired

        The destination IP range

      • srcPortRangeStringRequired

        The source port range, not implemented in the current version

      • dstPortRangeStringRequired

        The destination port range

      • actionStringRequired

        The default action of the rule

      • remoteSecurityGroupUuidStringRequired

        远程安全组UUID。

      • allowedCidrStringRequired

        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

      • startPortIntegerRequired

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

      • endPortIntegerRequired

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

      • createDateTimestampRequired

        The creation time

      • lastOpDateTimestampRequired

        The last modification time

Endpoint

POST/zstack/v1/security-groups/{securityGroupUuid}/rules

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

Operation ID

AddSecurityGroupRule

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/security-groups/{securityGroupUuid}/rules' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"rules":["<rules>"],"remoteSecurityGroupUuids":["<remoteSecurityGroupUuids>"],"priority":1,"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "5949aece9cd64d5a939d6dc5e2c1f327", "name": "web", "description": "for test", "state": "Enabled", "createDate": "Sep 22, 2017 12:24:11 PM", "lastOpDate": "Sep 22, 2017 12:24:11 PM", "internalId": 0 } }

Change History

This API has no change history records yet.

View all change history