Updated on 2024-04-18 GMT+08:00

Modifying ECS Details in a Batch

Function

This API is used to modify ECS details in a batch.

Currently, only ECS names can be changed in a batch, and the maximum number is 100 at a time.

URI

PUT /v1/{project_id}/cloudservers/server-name

Table 1 lists the URI parameters.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

name

String

Yes

Specifies the changed name of the ECSs.

The rules are as follows:

The parameter value consists of 1 to 128 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

After you change ECS names in a batch, the system does not automatically add a digital suffix to the changed names. For example, there are three ECSs, test_0001, test_0002, and test_0003. After their names are changed to develop in a batch, their changed names are all develop.

dry_run

Boolean

No

Specifies whether to check the request and change ECS names.

true: indicates that only the name change request is sent and the names of the ECSs will not be changed. Check items include mandatory parameters, request format, and service restrictions. If the check fails, the system returns an error. If the check result is as expected, the system properly responds.

See Responses (Batch Operation).

false: indicates that the name change request is sent and the ECS names will be changed if the check result is as expected.

The default value is false.

servers

Array of objects

Yes

Specifies the IDs of the target ECSs. For details, see Table 3.

Table 3 servers field description

Parameter

Type

Mandatory

Description

id

String

Yes

Specifies the ECS ID.

Example Request

Modify the names of the ECSs whose IDs are 260a0917-f7df-4b25-93ac-950da6c6b5d6 and f6d8df1a-e257-48e2-b617-1dd92ced8c20 to new-server-name.

PUT https://{endpoint}/v1/{project_id}/cloudservers/server-name

{
   "name": "new-server-name",
   "dry_run": false,
   "servers": [
               {
                 "id":"260a0917-f7df-4b25-93ac-950da6c6b5d6"  
               },
               {
                 "id":"f6d8df1a-e257-48e2-b617-1dd92ced8c20" 
               }
              ]
}

Example Response

See Responses (Batch Operation).

{      
    "response": [                   
                  {                     
                    "id": "616fb98f-46ca-475e-917e-2563e5a8cd19"                      
                  },                   
                  {                     
                    "id": "516fb98f-46ca-475e-917e-2563e5a8cd12"                      
                  }                
                 ] 
} 

Error Codes

See Error Codes.