Creating an ECS
Function
API for creating an ECS.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
workspace:server:create
Write
server *
-
-
- ims:images:list
- ims:images:updateMemberStatus
- ims:images:share
- ims:images:get
- vpc:securityGroups:get
- vpc:securityGroupRules:get
- vpc:networks:get
- vpc:subnets:get
- vpc:ports:create
- vpc:ports:get
- vpc:ports:delete
- vpc:vpcs:get
- dss:pools:list
serverGroup *
-
-
URI
POST /v1/{project_id}/app-servers/actions/create
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Unique ID of a project |
Request 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. |
| X-Linked-Id | No | String | Associated ID delivered when the transaction component is invoked. |
| Service-Transaction-Id | No | String | Service ID contained in the request header during CBC API callback. This parameter is mandatory for yearly/monthly billing, and is not specified for pay-per-use billing. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Type of the cloud service to be created. Option: createApps, which indicates cloud application. |
| server_group_id | Yes | String | Unique ID of a server group. |
| availability_zone | No | String | AZ. NOTE:
|
| subscription_num | Yes | Integer | Number of subscriptions. |
| nics | No | Array of Nic objects | Service NIC information. This field is reserved. |
| ou_name | No | String | OU name, which is used for connecting to the AD. An OU must be created in the AD in advance. |
| product_id | Yes | String | Product ID |
| flavor_id | No | String | Specification ID. |
| os_type | No | String | OS type. Only Windows is supported. |
| root_volume | Yes | Volume object | System disk: disk capacity (a multiple of 10, max. 1024 GB). |
| scheduler_hints | No | WdhParam object | Dedicated hosts support only pay-per-use billing, but not yearly/monthly billing. |
| subnet_id | Yes | String | ID of the NIC subnet. |
| vpc_id | Yes | String | VPC ID |
| update_access_agent | No | Boolean | Indicates whether to enable automatic HDA upgrade. |
| create_server_extend_param | No | CreateServerExtendParam object | Extended parameters for creating a cloud server. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| ip_address | No | String | IP address. |
| subnet_id | No | String | ID of the NIC subnet. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Disk type. For details about how to obtain available disk types, see parameter ListVolumeType. Options: ESSD: Extreme SSD SSD: Ultra-high I/O GPSSD: General-purpose SSD SAS: High I/O SATA: Common I/O |
| size | Yes | Integer | Disk capacity (a multiple of 10, in GB). Options: |
| cluster_id | No | String | ID of the storage pool used by the ECS system disk. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| dedicated_host_id | No | String | Workspace host ID. |
| tenancy | No | String | Dedicated host type. Currently, only dedicated is supported. Options include dedicated and shared. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| charging_mode | No | String | Billing mode. Options: prePaid: yearly/monthly postPaid: pay-per-use |
| period_type | No | Integer | Period type. The value 2 indicates monthly and 3 indicates yearly. This parameter must be specified when chargingMode is set to prePaid. |
| period_num | No | Integer | Number of subscription periods, which is a positive integer. This parameter is required when chargingMode is set to prePaid. |
| is_auto_renew | No | Boolean | Whether to enable automatic renewal. Options: |
| is_auto_pay | No | Boolean | Whether the order is automatically or manually paid. This parameter is available if chargingMode is set to prePaid. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| job_id | String | A job_id is returned after the pay-per-use application streaming server creation starts, and can be used for querying the task status. A job_id is returned after the pay-per-use application streaming server creation starts, and can be used for querying the task status. |
| order_id | String | Order ID, which is returned after the yearly/monthly ECS creation starts. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 405
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Example Requests
POST /v1/a4da8115c9d8464ead3a38309130523f/app-servers/actions/create
{
"availability_zone" : "cn-north-5a",
"subnet_id" : "085ca7d8-4474-4c32-bff0-31254d98c4a9",
"nics" : [ {
"subnet_id" : "085ca7d8-4474-4c32-bff0-31254d98c4a9"
} ],
"product_id" : "workspace.appstream.general.xlarge.2",
"flavor_id" : "c3.large.4",
"os_type" : "Windows",
"root_volume" : {
"type" : "SAS",
"size" : 80
},
"server_group_id" : "f309fa65-881a-4f49-8c06-31e20437ae20",
"vpc_id" : "d987ecf7-c6a4-4753-8b66-135dcc3eed79",
"ou_name" : "",
"update_access_agent" : false,
"type" : "createApps",
"subscription_num" : 1,
"create_server_extend_param" : {
"charging_mode" : "prePaid",
"period_type" : 3,
"period_num" : 2,
"is_auto_renew" : false,
"is_auto_pay" : false
}
} Example Responses
Status code: 200
Response to a successful request.
{
"job_id" : "575768277444198400",
"order_id" : "CS2310081912FP1MC"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Response to a successful request. |
| 400 | The request cannot be understood by the server due to malformed syntax. |
| 401 | Authentication failed. |
| 403 | Permissions required. |
| 404 | Resources not found. |
| 405 | The method specified in the request is not allowed. |
| 500 | An internal service error occurred. For details, see the error code description. |
| 503 | Service unavailable. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot