Updated on 2025-07-14 GMT+08:00

Creating a Desktop Pool

Function

Creates and assigns a desktop pool to a user or user group. When the user logs in, the user is bound to one of the desktops.

To use this function, you need to authorize the cloud service by calling the API for enabling the agency function.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v2/{project_id}/desktop-pools

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Desktop pool name, which must be unique. The desktop name can contain 1 to 255 characters, including uppercase letters, lowercase letters, digits, and hyphens (-).

type

Yes

String

Desktop pool type. The options are DYNAMIC (dynamic pool) and STATIC (static pool).

size

Yes

Integer

Desktop pool size: number of desktops to be created in the current desktop pool.

description

No

String

Desktop pool description.

availability_zone

No

String

AZ. Create a desktop in the specified AZ. If this parameter is not specified, the default AZ is used.

product_id

Yes

String

Package ID.

flavor_id

No

String

Product specification ID. This parameter is mandatory when the AZ is an edge AZ.

image_type

Yes

String

Specifies the image type. The default value is private.

  • private: Private image.

  • gold: Public image.

image_id

Yes

String

Image ID. This parameter is used together with product_id for creating desktops using custom images.

root_volume

Yes

VolumeInfo object

System disk.

data_volumes

No

Array of VolumeInfo objects

Data disks.

vpc_id

No

String

Specifies the VPC ID when the desktop is created.

subnet_ids

Yes

Array of strings

ID of the subnet used for creating a desktop.

security_groups

No

Array of SecurityGroup objects

Security group used by the desktop. If no security group is specified, the security group specified in the desktop agent is used by default.

authorized_objects

No

Array of AuthorizedObjects objects

Users or user groups to be authorized.

ou_name

No

String

OU name, which is used for connecting to the AD. An OU must be created in the AD in advance.

tags

No

Array of Tag objects

Tags.

enterprise_project_id

No

String

Enterprise project ID, which is 0 by default.

disconnected_retention_period

No

Integer

Number of minutes within which the binding relationship between a user and a desktop is retained when the dynamic pool desktop is disconnected. After the binding relationship times out, the user is automatically unbound.

enable_autoscale

No

Boolean

Specifies whether to enable auto scaling for the desktop pool. The value false indicates that auto scaling is disabled, and the value true indicates that auto scaling is enabled.

autoscale_policy

No

AutoscalePolicy object

Auto scaling policy.

desktop_name_policy_id

No

String

Policy ID, which is used to specify the desktop name generation policy.

Table 4 VolumeInfo

Parameter

Mandatory

Type

Description

id

No

String

Specifies the IDs of the disks to be operated in batches.

type

Yes

String

Desktop data disk type, which must be the same as the disk type provided by the system.

  • SAS: High I/O;

  • SSD: Ultra-high I/O

size

Yes

Integer

Disk capacity in GB.

resource_spec_code

No

String

Specifications.

Table 5 SecurityGroup

Parameter

Mandatory

Type

Description

id

Yes

String

Security group ID.

Table 6 AuthorizedObjects

Parameter

Mandatory

Type

Description

object_type

Yes

String

Enumeration of bound object types.

  • USER: user

  • USER_GROUP: user group

object_id

Yes

String

User ID or user group ID.

object_name

Yes

String

Username or user group name.

user_group

Yes

String

Specifies the user permission group to which the desktop user belongs.

  • sudo: Linux administrator group.

  • default: Default Linux user group.

  • administrators: Windows administrator group. Administrators have full access to the desktop and can make any required changes except for forbidden operations.

  • users: Standard Windows user group. Standard users can use most software programs and change system settings that do not affect other users.

created_at

No

String

Creation time. The value is in UTC format, for example, 2022-05-11T11:45:42.000Z.

Table 7 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key. This parameter cannot be left blank and can contain a maximum of 128 Unicode characters. The value can contain uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_). The value cannot contain the following characters: =*<>,|/.

value

No

String

Value of a tag, which can contain a maximum of 43 Unicode characters. The value can contain uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_). The value cannot contain the following characters: =*<>,|/.

Table 8 AutoscalePolicy

Parameter

Mandatory

Type

Description

autoscale_type

No

String

Auto scaling type. The options are as follows: ACCESS_CREATED: created during access; AUTO_CREATED: auto scaling.

max_auto_created

No

Integer

Maximum number of desktops that can be automatically created.

min_idle

No

Integer

When the number of idle desktops is less than the value of this parameter, desktops are automatically created.

once_auto_created

No

Integer

Number of desktops that can be automatically created at a time.

Response Parameters

Status code: 200

Table 9 Response body parameters

Parameter

Type

Description

job_id

String

ID of the cloud desktop creation task.

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 403

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 404

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Example Requests

{
  "name" : "POOL01",
  "type" : "STATIC",
  "size" : 50,
  "image_type" : "gold",
  "image_id" : "a866298d-67db-44b0-a1f1-9d09bdddc20f",
  "root_volume" : {
    "type" : "SAS",
    "size" : 80
  },
  "availability_zone" : "az3.manage.x86",
  "subnet_ids" : [ "5dee0216-2260-47c2-9368-98a27d910e55" ],
  "product_id" : "workspace.c2.large.windows.2"
}

Example Responses

Status code: 200

Response to the request for creating a desktop pool.

{
  "job_id" : "3979904c-7beb-4f34-835f-2fa989a5550a"
}

Status Codes

Status Code

Description

200

Response to the request for creating a desktop pool.

400

The request cannot be understood by the server due to malformed syntax.

401

Authentication failed.

403

No operation permissions.

404

No resources found.

500

An internal service error occurred. For details about the error code, see the error code description.

Error Codes

See Error Codes.