更新时间:2025-04-23 GMT+08:00

创建桌面订单

功能介绍

创建桌面订单。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v2/{project_id}/desktops/orders/subscribe

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表3 请求Body参数

参数

是否必选

参数类型

描述

enterprise_project_id

String

企业项目ID,默认"0。"

hour_package_resources

Array of HourPackageResource objects

小时包资源。

extend_param

OrderExtendParam object

订单的扩展参数。

表4 HourPackageResource

参数

是否必选

参数类型

描述

period_type

Integer

订购周期类型:2:月;3:年;必填。

period_num

Integer

订购周期数。

is_auto_renew

Integer

是否自动续订。

used_up_policy

String

时长用尽策略:

  • SHUTDOWN_OR_HIBERNATE:自动关机/休眠。

  • PAY_PER_USE:自动按需计费。

create_desktops

CreateDesktopReq object

创建桌面请求。

表5 CreateDesktopReq

参数

是否必选

参数类型

描述

desktop_type

String

云桌面类型。

  • DEDICATED:专属桌面,单用户。

  • SHARED: 多用户共享桌面。

availability_zone

String

可用分区。将桌面创建到指定的可用分区。如果不指定则使用系统随机的可用分区。

product_id

String

套餐ID。

image_type

String

镜像类型。默认值为private。

  • private:私有镜像。

  • gold:公共镜像。

image_id

String

镜像ID,用于私有镜像创建桌面场景,配合product_id使用。

root_volume

Volume object

系统盘。

data_volumes

Array of Volume objects

数据盘列表。

nics

Array of Nic objects

桌面对应的网卡信息,如果不指定则使用默认网卡。

security_groups

Array of SecurityGroup objects

桌面使用的安全组,如果不指定则默认使用桌面代理中指定的安全组。

desktops

Array of Desktop objects

创建桌面使用的参数列表。长度为1-100。

当前不支持一批桌面不同配置,所有桌面的配置和第一台的一致,如果第一台未设置参数,则取外层的同名参数。

desktop_name

String

搭配size使用,当size为1时代表桌面名,位数1-15,当size大于1时代表桌面名前缀,位数:1-13。

desktop_ips

Array of strings

桌面指定分配的ip地址列表,最小为0,最大为100。

size

Integer

创建不分配用户的桌面的个数,和desktops不能同时生效,搭配desktop_name使用。

email_notification

Boolean

创建成功后是否发送邮件通知桌面用户,默认为true。

enterprise_project_id

String

企业项目ID,默认"0。"

tags

Array of Tag objects

标签列表。

apply_shared_vpc_dedicated_param

ApplySharedVpcDedicatedParam object

共享Vpc专线入参。

eip

Eip object

EIP信息。

desktop_name_policy_id

String

策略id,用于指定生成桌面名称策略,如果指定了桌面名称则优先使用指定的桌面名称。

表6 Volume

参数

是否必选

参数类型

描述

type

String

桌面数据盘对应的磁盘类型,需要与系统所提供的磁盘类型相匹配。

-SAS:高IO。

-SSD:超高IO。

-GPSSD:通用型SSD。

size

Integer

磁盘容量,单位GB。系统盘大小范围[80-32760],数据盘范围[10-32760],大小为10的倍数。

表7 Nic

参数

是否必选

参数类型

描述

subnet_id

String

网卡对应的子网ID。

表8 SecurityGroup

参数

是否必选

参数类型

描述

id

String

安全组ID。

表9 Desktop

参数

是否必选

参数类型

描述

user_name

String

桌面所属的用户,当桌面创建成功后此用户可以登录该桌面。只允许输入大写字母、小写字母、数字、中划线(-)和下划线(_)。域类型为LITE_AD时,使用小写字母或者大写字母开头,长度范围为[1-20]。当域类型为LOCAL_AD时,用户名可以使用小写字母或者大写字母或者数字开头,长度范围为[1-32]。Windows桌面用户最长支持20个字符,Linux桌面用户最长支持32个字符。

user_email

String

合法用户邮箱,桌面创建成功后系统会通过发送邮件的方式通知用户。

user_phone

String

合法用户手机号。

user_group

String

桌面用户所属的用户组。

  • sudo:Linux管理员组。

  • default:Linux默认用户组。

  • administrators:Windows管理员组。管理员拥有对该桌面的完全访问权,可以做任何需要的更改(禁用操作除外)。

  • users:Windows标准用户组。标准用户可以使用大多数软件,并可以更改不影响其他用户的系统设置。

computer_name

String

桌面名,桌面名必须保证唯一。桌面名称只允许输入大写字母、小写字母、中文、数字、中划线,以字母或数字开头、不能以中划线结尾,长度范围为1~15(中文字符长度为2,数字及英文字符长度为1)。

os_host_name

String

系统计算机名。

desktop_name_prefix

String

桌面名称前缀,不指定"computer_name"时生效。

表10 Tag

参数

是否必选

参数类型

描述

key

String

标签的键,不能为空,最大长度128个unicode字符。大小写字母,数字,可以包含中划线“-”,下划线“_”,不能包含以下字符“=”,“*”,“<”,“>”,“\”,“,”,“|”,“/”。

value

String

标签的值,最大长度43个unicode字符。大小写字母,数字,可以包含中划线“-”,下划线“_”,不能包含以下字符“=”,“*”,“<”,“>”,“\”,“,”,“|”,“/”。

表11 ApplySharedVpcDedicatedParam

参数

是否必选

参数类型

描述

address

String

租户指定的共享Vpc专线地址。

port

Integer

租户指定共享Vpc专线地址端口。

availability_zone

Array of strings

开通服务资源使用的可用分区,默认随机使用2个可用区。

表12 Eip

参数

是否必选

参数类型

描述

id

String

桌面绑定的EIP的id,有值时优先绑定EIP。

type

String

EIP的类型,5_bgp(全动态BGP),5_sbgp(静态BGP)。

charge_mode

String

eip带宽计费模式

  • TRAFFIC:按流量计费。

  • BANDWIDTH:按带宽计费。

bandwidth_size

Integer

带宽大小。

表13 OrderExtendParam

参数

是否必选

参数类型

描述

is_auto_pay

String

是否自动付款。true:自动支付; false:不自动支付;默认false。

响应参数

状态码:200

表14 响应Body参数

参数

参数类型

描述

order_id

String

订单号,下单成功时返回订单ID。

状态码:400

表15 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

encoded_authorization_message

String

加密后的详细拒绝原因,用户可以自行调用STS服务的decode-authorization-message接口进行解密。

状态码:409

表16 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

encoded_authorization_message

String

加密后的详细拒绝原因,用户可以自行调用STS服务的decode-authorization-message接口进行解密。

状态码:500

表17 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

encoded_authorization_message

String

加密后的详细拒绝原因,用户可以自行调用STS服务的decode-authorization-message接口进行解密。

请求示例

{
  "enterprise_project_id" : "0",
  "hour_package_resources" : [ {
    "period_type" : 255,
    "period_num" : 2147483647,
    "is_auto_renew" : 0,
    "create_desktops" : {
      "desktop_type" : "string",
      "availability_zone" : "string",
      "product_id" : "string",
      "flavor_id" : "string",
      "share_resource_sku" : "string",
      "image_type" : "private",
      "image_id" : "string",
      "root_volume" : {
        "type" : "string",
        "size" : 32760,
        "cluster_id" : "string"
      },
      "data_volumes" : [ {
        "type" : "string",
        "size" : 32760,
        "cluster_id" : "string"
      } ],
      "nics" : [ {
        "subnet_id" : "string",
        "ip_address" : "string"
      } ],
      "security_groups" : [ {
        "id" : "string",
        "name" : "string"
      } ],
      "desktops" : [ {
        "user_name" : "string",
        "user_email" : "string",
        "user_phone" : "string",
        "user_group" : "string",
        "computer_name" : "string",
        "os_host_name" : "string",
        "nics" : [ {
          "subnet_id" : "string",
          "ip_address" : "string"
        } ],
        "ou_name" : "string",
        "desktop_name_prefix" : "strin"
      } ],
      "desktop_name" : "string",
      "desktop_ips" : [ "string" ],
      "size" : 100,
      "email_notification" : "true",
      "enterprise_id" : "string",
      "enterprise_project_id" : "0",
      "order_id" : "string",
      "ou_name" : "string",
      "vpc_id" : "string",
      "subnet_ids" : [ "string" ],
      "tags" : [ {
        "key" : "string",
        "value" : ""
      } ],
      "scheduler_hints" : {
        "tenancy" : "string",
        "dedicated_host_id" : "string"
      },
      "desktop_isv" : "DEFAULT",
      "access_mode" : "INTERNET",
      "apply_shared_vpc_dedicated_param" : {
        "address" : "string",
        "port" : 65535,
        "availability_zone" : [ "string" ]
      },
      "dedicated_subnets" : "192.168.0.0/24;10.0.0.0/16",
      "eip" : {
        "id" : "string",
        "type" : "string",
        "charge_mode" : "string",
        "bandwidth_size" : 2000
      },
      "adn" : {
        "charge_mode" : "string",
        "bandwidth_size" : 2000
      },
      "exclusive_host_id" : "string",
      "desktop_name_policy_id" : "string",
      "hour_package_product_id" : "string",
      "hour_package_offering_id" : "string",
      "root_resource_ids" : [ "string" ],
      "inst_info_ids" : [ "string" ]
    }
  } ],
  "order_id" : "string",
  "promotion_id" : "string",
  "promotion_plan_id" : "string",
  "promotion_info" : "string",
  "extend_param" : {
    "is_auto_pay" : "string"
  }
}

响应示例

状态码:200

下单响应体。

{
  "order_id" : "string"
}

状态码

状态码

描述

200

下单响应体。

400

由于包含语法错误,当前请求无法被服务器理解。

409

操作冲突。

500

服务器内部错误。

错误码

请参见错误码

我们使用cookie来确保您的高速浏览体验。继续浏览本站,即表示您同意我们使用cookie。 详情