Help Center/ Cloud Phone Host/ API Reference/ Cloud Phone Server APIs/ Cloud Phone Servers/ Changing the Cloud Phone Server for a Cloud Phone
Updated on 2024-08-09 GMT+08:00

Changing the Cloud Phone Server for a Cloud Phone

Function

This API is used to change the cloud phone server for a cloud phone. After the change, the cloud phone server name, ID, AZ, and billing mode are the same as those of the original cloud phone server. During the change, a new cloud phone is created on the new cloud phone server, and the user data on the original cloud phone is not retained. The cloud phone server change requires additional resources and resource quotas.

URI

POST /v2/{project_id}/cloud-phone/servers/{server_id}/change

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

server_id

Yes

String

Specifies the unique identifier of the cloud phone server.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling an Identity and Access Management (IAM) API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

phone_model_name

Yes

String

Specifies the cloud phone flavor, which contains a maximum of 64 bytes.

image_id

Yes

String

Specifies the cloud phone image ID, which can contain a maximum of 32 bytes.

keypair_name

No

String

Specifies the key pair name. The name can contain a maximum of 64 bytes and is used for logging in to the cloud phone through ADB.

ports

No

Array of Port objects

Specifies the application port enabled on the cloud phone. The CPH service forwards requests to and from the port.

extend_param

No

extend_param object

Extended field

tenant_vpc_id

Yes

String

Specifies the ID of the VPC you select for the cloud phone server to be created. The VPC ID is in UUID format.

nics

Yes

Array of Nic objects

Specifies the structure of the NIC you customized, which defines the NIC information of the cloud phone server to be created.

public_ip

Yes

public_ip object

Specifies the structure of the EIP you specified.

To bind an EIP to a cloud phone server, you can:

Let the system automatically assign an EIP. You need to specify the EIP type. Use an existing EIP by specifying its ID.

phone_count_per_ip

No

Integer

Number of mobile phones that share a VIP. The default value is the number of mobile phones, indicating that all mobile phones share one VIP. The value ranges from 1 to the number of mobile phone specifications.

phone_data_volume

No

phone_data_volume object

Mobile phone disk structure. This parameter is mandatory for 2.0 specifications.

server_share_data_volume

No

server_share_data_volume object

Shared storage disk structure. This parameter is optional for 2.0 specifications.

band_width

Yes

band_width object

Specifies the bandwidth used by the cloud phone.

Table 4 Port

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the application port name, which can contain a maximum of 16 bytes. The key service name cannot be adb or vnc.

listen_port

Yes

Integer

Specifies the port number, which ranges from 10000 to 50000.

internet_accessible

Yes

String

Specifies whether internet_accessible is enabled. When internet_accessible is set to true (case insensitive), you can access cloud phones over this port from the Internet. Otherwise, you cannot access cloud phones over this port from the Internet.

Table 5 extend_param

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise project ID If this parameter is not specified or is set to 0, resources will be bound to the default enterprise project.

Table 6 Nic

Parameter

Mandatory

Type

Description

subnet_id

Yes

String

Specifies the ID of the subnet you specified, which is the subnet where you will deploy your cloud phone server.

The value must be the ID of the subnet created in the VPC (tenant_vpc_id) and in UUID format.

ipv6_enable

No

Boolean

Specifies whether the NIC supports IPv6 addresses.

If this parameter is set to true, the NIC supports IPv6 addresses.

ipv6_bandwidth

No

ipv6_bandwidth object

Specifies the shared bandwidth bound to the NIC IPv6 addresses. For details, see the ipv6_bandwidth data structure.

Table 7 ipv6_bandwidth

Parameter

Mandatory

Type

Description

band_width_id

Yes

String

Specifies the ID of the shared bandwidth bound to the NIC IPv6 addresses.

Table 8 public_ip

Parameter

Mandatory

Type

Description

ids

No

Array of strings

Specifies the ID of the existing EIP selected for creating the cloud phone server. Only one existing EIP ID can be specified.

eip

No

eip object

Specifies the parameter for an EIP that will be automatically assigned. For details, see the EIP structure.

count

No

Integer

Number of EIPs. The default value is 1. If no EIP is required, set this parameter to 0. The value ranges from 0 to the number of mobile phone IP addresses.

Table 9 eip

Parameter

Mandatory

Type

Description

type

Yes

String

EIP type.

  • 5_telcom: China Telecom

  • 5_union: China Unicom

  • 5_bgp: dynamic BGP

  • 5_sbgp: static BGP

Table 10 phone_data_volume

Parameter

Mandatory

Type

Description

volume_type

Yes

String

Specifies the disk type. Only the following types are supported:

  • SSD

  • GPSSD

size

Yes

Integer

Specifies the cloud phone disk size, in GiB. The value ranges from 10 GiB to 32,768 GiB.

Table 11 server_share_data_volume

Parameter

Mandatory

Type

Description

volume_type

Yes

String

Specifies the disk type. Only the following types are supported:

  • SSD

  • GPSSD

size

Yes

Integer

Specifies the shared storage size on the cloud phone server, in GiB. The value ranges from 10 GiB to 32,768 GiB.

Table 12 band_width

Parameter

Mandatory

Type

Description

band_width_id

No

String

Specifies the unique identifier of the bandwidth used by the cloud phone server.

band_width_size

No

Integer

Specifies the bandwidth size of the cloud phone server.

band_width_charge_mode

Yes

Integer

Specifies the billing mode of the cloud phone server bandwidth.

  • 0: bandwidth (charged by bandwidth)

  • **1: traffic (charged by traffic)

band_width_share_type

Yes

Integer

Specifies the bandwidth type of the cloud phone server.

  • 0: per, exclusive bandwidth

  • 1: whole, shared bandwidth

Response Parameters

Status code: 200

Table 13 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

server_id

String

Specifies the server ID.

job_id

String

Task ID

Example Requests

Changing the cloud phone server for a cloud phone

POST https://{CPH Endpoint}/v2/{project_id}/cloud-phone/servers/{server_id}/change

{
  "phone_model_name" : "kg1.cp.c20.d64SSD.e1v1",
  "image_id" : "20060220200717f201120a2300000e91",
  "keypair_name" : "keypair",
  "ports" : [ {
    "name" : "myServer1",
    "listen_port" : 20000,
    "internet_accessible" : "false"
  }, {
    "name" : "myServer2",
    "listen_port" : 20001,
    "internet_accessible" : "true"
  } ],
  "extend_param" : {
    "enterprise_project_id" : "0"
  },
  "tenant_vpc_id" : "fca063f6-b942-42a8-9004-e5545f58d6a2",
  "nics" : [ {
    "subnet_id" : "f1cbfc37-eb42-4357-a0ec-9e4f11950908"
  } ],
  "public_ip" : {
    "eip" : {
      "type" : "5_bgp"
    }
  },
  "band_width" : {
    "band_width_share_type" : 0,
    "band_width_size" : 300,
    "band_width_charge_mode" : 1
  }
}

Example Responses

Status code: 200

OK

{
  "request_id" : "1564567b8bab40f34711234cb80d8574",
  "server_id" : "1234567b8bab40ffb711234cb80d0234",
  "job_id" : "3648acdc113a44d39a95f95bf3b8b01e"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.