• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. API Reference
  4. OpenStack Nova APIs
  5. Security Group Management
  6. Adding a Security Group

Adding a Security Group

Function Description

This interface is used to add an ECS to a security group.

You are suggested to add an ECS to a maximum of five security groups.

URI

POST /v2/{project_id}/servers/{server_id}/action

POST /v2.1/{project_id}/servers/{server_id}/action

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

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request parameter

Parameter

Type

Mandatory

Description

addSecurityGroup

Dict

Yes

Adds an ECS to a security group.

Table 3 addSecurityGroup parameter description

Parameter

Type

Mandatory

Description

name

String

Yes

Specifies the name of the security group to which the ECS is added. The name takes effect for the NICs on the ECS.

Response

N/A

Examples

  • Example request
    { 
        "addSecurityGroup": { 
            "name": "sg-test"
        }
    }

Returned Values

See General Request Returned Values.