更新时间:2025-02-28 GMT+08:00
分享

创建订单

功能介绍

创建订单。

调试

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

URI

POST /v1/{project_id}/bundles/subscribe/order

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目唯一标识。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

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

表3 请求Body参数

参数

是否必选

参数类型

描述

resources

Array of Resource objects

包周期资源对象。

type

String

createApps【添加云应用】。

表4 Resource

参数

是否必选

参数类型

描述

add_volumes

AddVolumes object

磁盘订单请求。

cloud_service_console_url

String

支付后跳转的地址。

create_services

CreateServices object

云服务产品下单实体。

is_auto_renew

Integer

订购关系当前是否是自动续费:0 否 1 是。

period_num

Integer

订购周期数取值大于0。

period_type

Integer

包周期订单订购周期类型:2:月;3:年;4:包小时(仅限带宽加油包购买场景使用)5:绝对时间;(追加附属资源场景使用,比如主机上追加云硬盘)6:一次性(chargingMode=1 一次性计费场景使用),必填。

subscription_num

Integer

订购数量。

表5 AddVolumes

参数

是否必选

参数类型

描述

service_id

String

服务ID。

volumes

Array of Volume objects

订单的磁盘信息列表。

表6 CreateServices

参数

是否必选

参数类型

描述

availability_zone

String

可用分区。

说明:
  • 将服务创建到指定的可用分区,如果不指定则使用系统随机的可用分区。

  • 获取方式详见可用区管理ListAvailabilityZone:"GET /v1/{project_id}/availability-zone"。

data_volumes

Array of Volume objects

数据盘。

nics

Array of Nic objects

网卡信息,该字段当前未使用。

ou_name

String

OU名称,在对接AD时使用,需提前在AD中创建OU。

product_id

String

产品ID。

说明:
  • 获取方式详见产品套餐管理ListProduct:"GET /v1/{project_id}/product"。

flavor_id

String

规格ID。

os_type

String

操作系统类型,当前仅支持Windows

  • Linux

  • Windows

root_volume

Volume object

默认系统卷信息 size取值:minLength: 10,maxLength: 1024。

server_group_id

String

服务器组ID, 云应用创建服务组时生成。

service_type

String

云服务类型,云桌面固定为DEDICATED。

subnet_id

String

子网ID。

vpc_id

String

自动开户的时候,用于LiteAs第一次开户传进来。

security_groups

Array of SecurityGroup objects

服务器使用的安全组,如果不指定则默认使用服务器代理中指定的安全组。

⚠ 警告: 预留属性,目前未使用

update_access_agent

Boolean

是否自动升级hda版本。

表7 Volume

参数

是否必选

参数类型

描述

type

String

磁盘类型,获取可用磁盘类型详见接口磁盘管理ListVolumeType。

  • ESSD - 极速型SSD

  • SSD - 超高IO

  • GPSSD - 通用型SSD

  • SAS - 高IO

  • SATA - 普通IO

size

Integer

磁盘容量,单位GB,数值约束为10的倍数。

  • 系统盘 minLength: 10,maxLength: 1024

  • 数据盘 minLength: 10,maxLength: 32768

cluster_id

String

云服务器系统盘对应的存储池的ID。

表8 Nic

参数

是否必选

参数类型

描述

ip_address

String

IP地址。

subnet_id

String

网卡对应的子网ID。

表9 SecurityGroup

参数

是否必选

参数类型

描述

id

String

安全组ID。

name

String

安全组名称。

响应参数

状态码:200

表10 响应Body参数

参数

参数类型

描述

order_id

String

订单ID。

状态码:400

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

状态码:401

表12 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

状态码:403

表13 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

状态码:500

表14 响应Body参数

参数

参数类型

描述

error_code

String

错误码,失败时返回。

error_msg

String

错误描述。

请求示例

{
  "resources" : [ {
    "add_volumes" : {
      "service_id" : "string",
      "volumes" : [ {
        "type" : "SSD",
        "size" : 10,
        "cluster_id" : "c950ee97-587c-4f24-8a74-3367e3da570f"
      } ]
    },
    "cloud_service_console_url" : "http://10.*.*.0:8003/v1/{project_id}/bundles/services/create",
    "create_services" : {
      "availability_zone" : "cn-north-5a",
      "data_volumes" : [ {
        "type" : "SSD",
        "size" : 10,
        "cluster_id" : "c950ee97-587c-4f24-8a74-3367e3da570f"
      } ],
      "nics" : [ {
        "ip_address" : "string",
        "subnet_id" : "197c1aa4-2611-48bd-a3af-ac4ce2c17c4c"
      } ],
      "ou_name" : "string",
      "product_id" : "workspacehost.s.large2.p01",
      "flavor_id" : "c3.large.4",
      "os_type" : "Windows",
      "root_volume" : {
        "type" : "SSD",
        "size" : 10,
        "cluster_id" : "c950ee97-587c-4f24-8a74-3367e3da570f"
      },
      "server_group_id" : "1",
      "service_type" : "string",
      "subnet_id" : "197c1aa4-2611-48bd-a3af-ac4ce2c17c4c",
      "vpc_id" : "string",
      "security_groups" : [ {
        "id" : "string",
        "name" : "string"
      } ],
      "update_access_agent" : "true"
    },
    "is_auto_renew" : 1,
    "period_num" : 3,
    "period_type" : 3,
    "subscription_num" : 3
  } ],
  "type" : "createApps"
}

响应示例

状态码:200

成功响应。

{
  "order_id" : "CS23060117315YQ6Z"
}

状态码

状态码

描述

200

成功响应。

400

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

401

鉴权失败。

403

没有操作权限。

500

服务内部错误,具体返回错误码请参见错误码说明。

错误码

请参见错误码

相关文档