• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Security Group Management
  6. Updating a Security Group (Discarded)

Updating a Security Group (Discarded)

Function

This API is used to update a security group.

Constraints

This API will be discarded.

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

URI

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

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

security_group_id

Yes

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

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

security_group

Dict

Yes

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

Table 3 Objects of request parameter security_group

Parameter

Type

Mandatory

Description

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

Response parameters

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Mandatory

Description

security_group

Dict

Yes

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

Table 5 Objects of response parameter security_group

Parameter

Type

Mandatory

Description

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 6.

tenant_id

String

Yes

Specifies the tenant or project ID.

The value cannot exceed 255 characters.

Table 6 security_group_rule objects

Parameter

Type

Mandatory

Description

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 icmp, tcp, udp, 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 7. 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 8. The value of ip_range or group must be empty.

id

String

Yes

Specifies the security group rule ID in UUID format.

Table 7 ip_range objects

Parameter

Type

Mandatory

Description

cidr

String

Yes

Specifies the peer IP segment in CIDR format.

The value cannot exceed 255 characters.

Table 8 group objects

Parameter

Type

Mandatory

Description

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.

Examples

  • Example request
    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"
        }
    }
  • Example response
    {
      "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.