Skip to main content
Resource Center/Network Service/Network Service Operations/Security Group Operations

CreateSecurityGroup

CreateSecurityGroup

POST/zstack/v1/security-groups

Operation ID

CreateSecurityGroup

Since

0.6

Execution Mode

Synchronous

Auth Context

Auth Required

Auth Context

Send these values as request headers when calling this API.

AuthorizationstringRequired

Bearer Token

X-Tenant-IDstring

X-Tenant-ID

Request Inputs

application/json

Body Fields

  • params
    ObjectRequired

    Request body parameter object.

    • name
      StringRequired

      The resource name.

    • description
      String

      Optional. The detailed description of the resource.

    • ipVersion
      Integer

      Optional. The IP version.

    • resourceUuid
      String

      Optional. The resource UUID. If specified, the system will not allocate randomly a UUID to the resource.

  • systemTags
    List

    Optional. The system tags.

  • userTags
    List

    Optional. The user tags.

Responses

200 OK
200 OK

On success, this API returns the following response structure.

  • error
    ErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • code
      StringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • description
      StringRequired

      The brief description of the error.

    • details
      StringRequired

      The details about the error.

    • elaboration
      StringRequired

      The reserved field. Default value: null.

    • opaque
      LinkedHashMapRequired

      The reserved field. Default value: null.

    • cause
      ErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventory
    SecurityGroupInventoryRequired

    See inventory.

    • uuid
      StringRequired

      The resource UUID.

    • name
      StringRequired

      The resource name.

    • description
      StringRequired

      The detailed description of the resource.

    • state
      StringRequired

      The resource state.

    • ipVersion
      IntegerRequired

      The IP version.

    • createDate
      TimestampRequired

      The creation date.

    • lastOpDate
      TimestampRequired

      The last operation date.

    • attachedL3NetworkUuids
      SetRequired

      The attached L3 network UUIDs.

    • rules
      ListRequired

      See rules.

      • uuid
        StringRequired

        The resource UUID.

      • securityGroupUuid
        StringRequired

        The security group UUID.

      • type
        StringRequired

        The traffic type.

      • ipVersion
        IntegerRequired

        The IP version.

      • startPort
        IntegerRequired

        If the protocol is TCP or UDP, this parameter is the start port of the port range. If the protocol is ICMP, this parameter is the ICMP type.

      • endPort
        IntegerRequired

        If the protocol is TCP or UDP, this parameter is the end port of the port range. If the protocol is ICMP, this parameter is the ICMP type.

      • protocol
        StringRequired

        The traffic protocol type.

      • state
        StringRequired

        The rule state, which is not implemented in the current version.

      • allowedCidr
        StringRequired

        The allowed CIDR, which has different meanings according to different traffic types. If the traffic type is Ingress, the allowed CIDR is a source CIDR that is allowed to access VM NICs. If the traffic type is Egress, the allowed CIDR is a destination CIDR that is allowed to leave from VM NICs.

      • remoteSecurityGroupUuid
        StringRequired

        The remote security group UUID.

      • createDate
        TimestampRequired

        The creation date.

      • lastOpDate
        TimestampRequired

        The last operation date.