Purchasing a Cloud Phone Server
URI
POST /v1/{project_id}/cloud-phone/phones
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request
- Request parameters
Parameter
Mandatory
Type
Description
server_name
Yes
String
Specifies the Cloud Phone server name.
The value can contain a maximum of 60 characters, including only letters, digits, underscores (_), and hyphens (-).
If you purchase multiple Cloud Phone servers at a time, the system automatically adds a sequence number suffix to the end of each server name. For example, the system automatically changes server-1 you set to server-1-0001.
server_model_name
Yes
String
Specifies the Cloud Phone server flavor. The value can contain a maximum of 64 bytes.
You can query the supported Cloud Phone server flavors by referring to Querying the Cloud Phone Server Flavors. Offline flavors cannot be used to purchase Cloud Phone servers.
phone_model_name
Yes
String
Specifies the cloud phone flavor, which contains a maximum of 64 bytes.
You can query the supported cloud phone specifications by referring to Querying the Cloud Phone Flavors.
image_id
Yes
String
Specifies the cloud phone image ID, which contains a maximum of 32 bytes.
You can query the image ID corresponding to the cloud phone specifications by referring to Querying a Cloud Phone Image.
count
Yes
Integer
Specifies the number of Cloud Phone servers to be purchased. A maximum of 10 servers can be purchased.
band_width
Yes
band_width structure
Specifies the bandwidth used by the cloud phone. The dedicated bandwidth is charged by traffic. The size of a shared bandwidth can be set. For details, see Table 2.
extend_param
Yes
extend_param structure
Specifies the billing mode parameters. For details, see Table 3.
keypair_name
No
String
Specifies the key pair name, which contains a maximum of 64 bytes and is used for logging in to the cloud phone through ADB.
You can obtain the key pair as follows:
- Log in to the HUAWEI CLOUD management console. On the Service List page, choose Computing > Elastic Cloud Server.
- In the navigation pane on the left, choose Key Pair.
vnc_enable
No
String
Specifies whether to enable the VNC login.
- This feature is enabled when vnc_enable is set to true (case insensitive).
- If the value is others, the feature is disabled.
ports
No
Port structure array
Specifies the application port enabled by the cloud phone. The Cloud Phone service forwards the port. For details, see Table 4.
subnet_cidr
No
String
Specifies the Cloud Phone server subnet. The system automatically creates a 172.31.0.0/16 subnet when you purchase the server for the first time. If you want to customize the subnet, you need to purchase all the subnets through APIs. The configured subnet must be in the subnet format and cannot overlap the existing subnet.
Table 2 band_width field description Parameter
Mandatory
Type
Description
band_width_id
No
String
Specifies the shared bandwidth ID. This parameter is preferentially used to bind a bandwidth to the cloud phone.
You can obtain the bandwidth ID by referring to Querying Bandwidth Information.
band_width_share_type
No
This parameter is mandatory when band_width_id does not exist.
Integer
Specifies the bandwidth type.
- 0: dedicated bandwidth
- 1: shared bandwidth
band_width_size
No
This parameter is mandatory when band_width_share_type is set to 1.
Integer
Specifies the bandwidth size. The value is greater than 0 and less than or equal to 300. (Unit: Mbit/s)
The default dedicated bandwidth is 300 Mbit/s.
Table 3 extend_param field description Parameter
Mandatory
Type
Description
charging_mode
Yes
Integer
Specifies how a Cloud Phone server is billed.
0: yearly/monthly
period_type
Yes
Integer
Specifies the subscription period.
- 2: month
- 3: year
period_num
Yes
Integer
Specifies the number of subscription periods.
If the subscription period is a month, the value ranges from 1 to 9.
If the subscription period is a year, the value ranges from 1 to 10.
is_auto_pay
No
Integer
Specifies whether to automatically pay fees. By default, automatic payment is disabled.
- 1: automatic payment
- 0: Automatic payment is disabled.
Table 4 Port structure array Parameter
Mandatory
Type
Description
name
Yes
String
Specifies the application port name, which contains a maximum of 16 bytes. The key service name cannot be adb or vnc.
listen_port
Yes
Integer
Specifies the port number. The value ranges from 10000 to 50000.
internet_accessible
Yes
String
- If the value is true (case insensitive), public network access is mapped.
- Otherwise, the mapping is not performed.
- Example request
POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones { "server_name": "myPhoneServer", "server_model_name": "physical.rx1.xlarge", "phone_model_name": "aphs1.medium.4.aosp", "image_id": "88b8449b896f3a4f0ad57222dd919899", "count": 3, "keypair_name": "mykeypair", "vnc_enable": "true", "ports": [ { "name": "myServer1", "listen_port": 20000, "internet_accessible": "false" }, { "name": "myServer2", "listen_port": 20001, "internet_accessible": "true" } ], "band_width":{ "band_width_share_type": 0 }, "extend_param": { "charging_mode": 0, "period_type": 2, "period_num": 1, "is_auto_pay": 1 } }
Response
- Parameter description
Parameter
Type
Description
request_id
String
Specifies the request ID, which is unique. The value can contain a maximum of 32 bytes.
order_id
String
Specifies the order ID, which contains a maximum of 64 bytes.
product_id
String
Specifies the product ID, which contains a maximum of 64 bytes.
- Example response
{ "request_id": "1564567b8bab40f34711234cb80d8574", "order_id": "CS1710111105S8IPB", "product_id": "00301-25217-0--0" }
Returned Values
See Returned Values.
Error Codes
See Error Codes.
Last Article: Querying the Cloud Phone Server Flavors
Next Article: Restarting Cloud Phone Servers In Batches
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.