Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Atualizado em 2022-11-08 GMT+08:00

Modifying the Specifications of an ECS

Function

This API is used to modify ECS specifications.

The V1.1 API supports all functions (see Modificação das especificações de um ECS (Pay-per-Use)) provided by the V1 API. Additionally, the V1.1 API supports the modification of yearly/monthly ECSs.

Constraints

  • You can modify the ECS specifications only when the ECS is stopped.
  • Spot ECSs do not support specifications modification.

URI

POST /v1.1/{project_id}/cloudservers/{server_id}/resize

Tabela 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtenção de um ID de projeto.

server_id

Yes

Specifies the ECS ID.

You can obtain the ECS ID from the console or by following the instructions provided in "Querying Details About an ECS".

Request

Parameter description

Parameter

Mandatory

Type

Description

resize

Yes

Object

Specifies the operation to modify ECS specifications. For details, see Tabela 2.

dry_run

No

Boolean

Specifies whether to only check the request and not modify the ECS specifications.

true: The request is sent and the ECS specifications will not be modified. Check items include mandatory parameters and request format.

  • If the check fails, the system returns an error.
  • If the check is successful, the system returns status code 202.

false: The request is sent and the ECS specifications will be modified if the check is successful.

Tabela 2 resize field description

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Specifies the flavor ID of the ECS after the modification.

You can view Consulta de variantes de ECS de destino para os quais uma variante pode ser alterado to query the target flavors to which a specified ECS flavor can be changed.

NOTA:
  • Modifications between the same flavor are not supported.

dedicated_host_id

No

String

Specifies the new DeH ID, which is applicable only to the ECSs on DeHs.

extendparam

No

Object

Modify the extended information about an ECS. For details, see Tabela 3.

Tabela 3 extendparam field description

Parameter

Mandatory

Type

Description

isAutoPay

No

String

Specifies whether the order is automatically or manually paid.

  • true: The order will be automatically paid.
  • false: The order must be manually paid.
NOTA:

This parameter is valid only for yearly/monthly ECSs. When this parameter is left blank, the order must be manually paid by default.

Response

Tabela 4 Parameter description

Parameter

Mandatory

Type

Description

job_id

No

String

Specifies the task ID. This parameter is returned when you modify the specifications of a pay-per-use ECS.

For details about task statuses, see Consulta do status de execução da tarefa.

order_id

No

String

Specifies the order ID. This parameter is returned when you modify the specifications of a yearly/monthly ECS.

Example Request

POST https://{endpoint}/v1.1/{project_id}/cloudservers/{server_id}/resize
{
    "resize": {
        "flavorRef": "s3.large.2",
        "dedicated_host_id": "459a2b9d-804a-4745-ab19-a113bb1b4ddc",
        "extendparam":{
             "isAutoPay": "true"
        },
       
    }
}

Example Response

{
    "job_id": "70a599e0-31e7-49b7-b260-868f441e862b"
}

Or

{
    "order_id": "CS1711152257C60TL",
    "job_id": "70a599e0-31e7-49b7-b260-868f441e862b"
}

Or

{
    "error": {
        "message": "XXXX", 
        "code": "XXX"
    }
}

Error Codes

See Códigos de erro.