• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Security groups
  6. Updating a Security Group

Updating a Security Group

Function Description

This interface is used to update a security group.

URI

  • URI format

    PUT /v2/{tenant_id}/os-security-groups/{security_group_id}

    PUT /v2.1/{tenant_id}/os-security-groups/{security_group_id}

  • Parameter description

    Parameter

    Mandatory

    Description

    tenant_id

    Yes

    Specifies the tenant or project ID.

    security_group_id

    Yes

    Specifies the security group ID, which is specified in the URI.

Restrictions

This interface will become invalid from micro version 2.36. Since this version, the system will return error 404 when you call this interface.

You are advised to use the desired network interface. For details, see section "Security Group (Native OpenStack API) > Updating a Security Group" in Virtual Private Network API Reference.

Request

Parameter

Type

Mandatory

Remarks

security_group

Dict

Yes

Specifies the security group in the message body. For details, see Table 1.

Table 1 Objects of request parameter security_group

Parameter

Type

Mandatory

Remarks

name

String

Yes

Specifies the security group name.

The value cannot exceed 255 characters.

description

String

Yes

Specifies information about a security group.

The value cannot exceed 255 characters.

Response

Parameter

Type

Mandatory

Remarks

security_group

Dict

Yes

Specifies the security group. For details, see Table 2.

Table 2 Objects of response parameter security_group

Parameter

Type

Mandatory

Remarks

description

String

Yes

Specifies information about a security group.

The value cannot exceed 255 characters.

id

String

Yes

Specifies the security group ID in UUID format.

name

String

Yes

Specifies the security group name.

The value cannot exceed 255 characters.

rules

List(security_group_rule)

Yes

Specifies the security group rule list. For details, see Table 3.

tenant_id

String

Yes

Specifies the tenant or project ID.

The value cannot exceed 255 characters.

Table 3 security_group_rule objects

Parameter

Type

Mandatory

Remarks

parent_group_id

String

Yes

Specifies the associated security group ID in UUID format.

ip_protocol

String

Yes

Specifies the protocol type or the IP protocol number. The value can be icmptcpudp, or the IP protocol number.

from_port

Int

Yes

Specifies the start port. The value ranges from 1 to 65,535 and cannot be greater than to_port. When ip_protocol is icmp, this parameter specifies a port type with a length from 0 to 255 characters.

to_port

Int

Yes

Specifies the end port. The value ranges from 1 to 65,535 and cannot be less than from_port. When ip_protocol is icmp, it specifies the code. The value ranges from 0 to 255. If both from_port and to_port are –1, any ICMP packet can be transmitted.

ip_range

Dict

Yes

Specifies the peer IP segment in CIDR format. For details, see Table 4. The value of ip_range or group must be empty.

group

Dict

Yes

Specifies the name of the peer security group and the ID of the tenant in the peer security group. For details, see Table 5. The value of ip_range or group must be empty.

id

String

Yes

Specifies the security group rule ID in UUID format.

Table 4 ip_range objects

Parameter

Type

Mandatory

Remarks

cidr

String

Yes

Specifies the peer IP segment in CIDR format.

The value cannot exceed 255 characters.

Table 5 group objects

Parameter

Type

Mandatory

Remarks

tenant_id

String

Yes

Specifies the ID of the tenant of the peer security group.

name

String

Yes

Specifies the name of the peer security group.

Request Example

PUT /v2/bb1118612ba64af3a6ea63a1bdcaa5ae/os-security-groups/3d02312d-0764-49c9-8244-2368ddce0045
PUT /v2.1/bb1118612ba64af3a6ea63a1bdcaa5ae/os-security-groups/3d02312d-0764-49c9-8244-2368ddce0045
{
    "security_group": {
        "name": "test",
        "description": "description"
    }
}

Response Example

{
  "security_group": {
    "rules": [
      {
        "from_port": null,
        "group": {
          "tenant_id": "bb1118612ba64af3a6ea63a1bdcaa5ae",
          "name": "test"
        },
        "ip_protocol": null,
        "to_port": null,
        "parent_group_id": "3d02312d-0764-49c9-8244-2368ddce0045",
        "ip_range": {},
        "id": "00dec0b6-8e96-4906-aadf-46cfe54cf5ef"
      }
    ],
    "tenant_id": "bb1118612ba64af3a6ea63a1bdcaa5ae",
    "id": "3d02312d-0764-49c9-8244-2368ddce0045",
    "name": "test",
    "description": "description"
  }
}

Returned Values

See General Request Returned Values.